Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were occasionally seeing apps tests fail with something like:
Looking at this line, it appeared to be this one https://github.com/code-dot-org/code-dot-org/blob/staging/apps/src/StudioApp.js#L1618.
StudioApp.init() adds a change handler to Blockly.mainWorkspace. I assume that what is happening is that sometimes some other test does something that causes this change handler to be called, we call updateBlockCount, and we fail because the element does not exist.
This might all be another indication that this isn't a great "unit" test. Ideally we would have a way of saying
afterEach(() => cleanUpAllListeners())
. In the absence of that, this might be the best we can do.I can't be certain this fixes the problem, as I was hitting it very intermittently, but it seems like it should fix it.