Reset SourcesTree when necessary#5200
Conversation
wldcordeiro
left a comment
There was a problem hiding this comment.
Looks good. I've made the mistake of using the old props too 😆 Odd that the yarn.lock file changed though.
|
Oh wow - that's a nice catch. Would it be possible to add a new unit test for SourcesTree? Here is a unit test for the Outline component which is similar |
|
Nice catch! A test would be great. |
| item.contents.get && | ||
| item.contents.has("id") && | ||
| sources.has(item.contents.get("id")) && | ||
| sources.get(item.contents.get("id")).get("isBlackBoxed") |
There was a problem hiding this comment.
I feel this might be split into two parts to reduce the time it takes to parse.
| @@ -212,7 +214,7 @@ class SourcesTree extends Component<Props, State> { | |||
|
|
|||
| if (!nodeHasChildren(item)) { | |||
| const source = sources.get(item.contents.get("id")); | |||
There was a problem hiding this comment.
We could be able to set this a bit further above and reuse here.
156605c to
1183310
Compare
|
I have created a test... it seemed way too easy so if I have done anything dumb then please let me know. |
1183310 to
4038c4a
Compare
|
The tests are a good start. I think we want to have a test that simulates changing the sources via setting new props: this test has a good example of that https://github.com/devtools-html/debugger.html/blob/master/src/components/Editor/tests/Editor.spec.js#L68-L73 |
4038c4a to
d6bb3b4
Compare
d6bb3b4 to
b61a318
Compare
|
Should be good to go now. |
b61a318 to
0595a24
Compare
|
just rebased. |
0595a24 to
a7363d1
Compare
Pull request #5004 introduced an issue where the SourcesTree was not updated when navigating to a new URL. In reality it was setting the tree using
props.blahinstead ofnextProps.blah.This also fixes a couple of undefined errors I was randomly getting in the console.