Repository navigation
fix(toast): a toast's auto-remove timer no longer outlives its provider - #193
Merged
Merged
Conversation
showToast started a timer and nothing ever cleared it. In a test the timer could fire after the page was torn down and set state with no window: the push run of 7538e48 failed on "ReferenceError: window is not defined" (from AgendaTab.test.jsx) with all 3,422 tests passing, while the pull request run of the same commit passed. Both apps' providers now clear their pending timers when they unmount, and a showToast that arrives after that shows nothing and starts no timer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No issue: found in CI after #192 merged.
Why
The push run of
7538e48on dev failed withReferenceError: window is not definedalthough all 3,422 tests passed (run); the pull request run of the same commit passed. The error came fromToastContext.jsx:26, reached fromAgendaTab.test.jsx: a toast's auto-remove timer fired after the test page had been torn down. It is a race, so it can fail any run, including the release PR's (#191).What changes
showToaststarted asetTimeoutthat nothing ever cleared. In both apps'ToastProvider:showToastthat arrives after the provider has gone shows nothing and starts no timer.Nothing changes while the provider is mounted: a toast shows and leaves as before.
Security
None.
Production impact
No flag. No visible change. In the apps the provider lives as long as the page, so this only matters when it unmounts.
Testing
npm test: 168 files, 3,426 passed, no unhandled errorsnpm run test:e2e: 264 passed, 1 skippednpm run test:specs: 18 specs validEvidence (real Zoom client)
None needed: no Zoom-only surface, and no Zoom-client spec covers
ToastContext.jsx.Not verified
The original failure is a race and was not reproduced as such; the new tests check its cause (a timer left after unmount) directly.
Look here first
apps/zoom-app/src/context/ToastContext.jsx(the web copy is the same change).