Repository navigation
refactor(status-bar): move the update-error panel out of the strip - #610
Merged
Merged
Conversation
StatusBar carried ninety lines of inline JSX for the update-failure panel, plus its own state, ref, click-outside effect, diagnostic assembly and two handlers — in a component meant to show indicators (#451). None of it was shared with the rest of the bar. UpdateErrorDetails owns all of it. StatusBar drops from 506 lines to 383, and loses two useState, one useRef and two useEffect calls. One thing the tests caught, worth stating because I had it wrong in a comment before the test disagreed: an early `return null` does not unmount a component. React keeps the instance and its state while the element stays in the same position, so the panel would have come back open on the next failure. The reset StatusBar used to own is still needed — it now lives with the state it resets, which is where it belonged. The diagnostic is still built on render rather than memoised. It carries a timestamp, and one frozen at mount would report when the app started rather than when the user copied it. Closes #451 Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #451.
StatusBarcarried ninety lines of inline JSX for the update-failure panel, plus its own state, ref, click-outside effect, diagnostic assembly and two handlers — in a component meant to show indicators. None of it was shared with the rest of the bar.UpdateErrorDetailsowns all of it. StatusBar drops 506 → 383 lines and loses twouseState, oneuseRefand twouseEffect.One thing the tests caught, and I had wrong
I removed StatusBar's "close the panel when the status leaves error" effect, on the reasoning that the extracted component returns
nulland therefore unmounts. It doesn't. React keeps the instance and its state while the element stays in the same position, so the panel would have come back open on the next failure.I'd already written a comment asserting the wrong thing before the test disagreed with me. The reset is still needed — it now lives with the state it resets, which is where it belonged.
Unchanged on purpose
The diagnostic is still built on render rather than memoised: it carries a timestamp, and one frozen at mount would report when the app started rather than when the user copied it.
Verification
12 new tests. Unit 2014, browser 300, 0 lint errors.