Skip to content

Commit 34ffcb5

Browse files
authored
Merge pull request github#4593 from asgerf/js/react-hot
Approved by erik-krogh
2 parents 7791ec3 + f894cf2 commit 34ffcb5

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* Hot-reloading React component are now recognized. Affects the package `react-hot-loader`.

javascript/ql/src/semmle/javascript/frameworks/React.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ private DataFlow::SourceNode higherOrderComponentBuilder() {
742742
or
743743
result = DataFlow::moduleMember("react-redux", "connect").getACall()
744744
or
745+
result = DataFlow::moduleMember(["react-hot-loader", "react-hot-loader/root"], "hot").getACall()
746+
or
745747
result = reactRouterDom().getAPropertyRead("withRouter")
746748
or
747749
exists(FunctionCompositionCall compose |

javascript/ql/test/library-tests/frameworks/ReactJS/higherOrderComponent.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
33
import { compose } from 'redux';
44
import styled from 'styled-components';
55
import unknownFunction from 'somewhere';
6+
import { hot } from 'react-hot-loader';
67

78
import { MyComponent } from './exportedComponent';
89

@@ -21,4 +22,4 @@ const withConnect = connect(mapStateToProps, mapDispatchToProps);
2122

2223
const ConnectedComponent = compose(withConnect, unknownFunction)(StyledComponent);
2324

24-
export default memo(ConnectedComponent);
25+
export default hot(module)(memo(ConnectedComponent));

0 commit comments

Comments
 (0)