File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
src/semmle/javascript/frameworks
test/library-tests/frameworks/ReactJS Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,10 @@ abstract class ReactComponent extends ASTNode {
207207 // getDerivedStateFromProps: (props, state)
208208 callback = getStaticMethod ( "getDerivedStateFromProps" ) .flow ( ) and
209209 stateParameterIndex = 1
210+ or
211+ // getSnapshotBeforeUpdate: (prevProps, prevState)
212+ callback = getInstanceMethod ( "getSnapshotBeforeUpdate" ) .flow ( ) and
213+ stateParameterIndex = 1
210214 )
211215 }
212216
@@ -258,6 +262,11 @@ abstract class ReactComponent extends ASTNode {
258262 // getDerivedStateFromProps: (props, state)
259263 callback = getStaticMethod ( "getDerivedStateFromProps" ) .flow ( ) and
260264 propsParameterIndex = 0
265+ or
266+ // getSnapshotBeforeUpdate: (prevProps, prevState)
267+ callback = getInstanceMethod ( "getSnapshotBeforeUpdate" ) .flow ( ) and
268+ propsParameterIndex = 0
269+
261270 )
262271 }
263272
Original file line number Diff line number Diff line change 11| rare-lifecycle-methods.js:1:1:11:1 | class C ... }\\n} | rare-lifecycle-methods.js:2:44:2:48 | state |
2+ | rare-lifecycle-methods.js:1:1:11:1 | class C ... }\\n} | rare-lifecycle-methods.js:8:40:8:48 | prevState |
23| statePropertyReads.js:1:1:13:1 | class R ... }\\n} | statePropertyReads.js:7:24:7:32 | prevState |
34| statePropertyReads.js:1:1:13:1 | class R ... }\\n} | statePropertyReads.js:10:35:10:43 | prevState |
You can’t perform that action at this time.
0 commit comments