Repository navigation
Stop a story's note box taking focus again on each return to that story - #124
Open
selfie-bot wants to merge 1 commit into
Open
selfie-bot wants to merge 1 commit into
selfie-bot wants to merge 1 commit into
Conversation
…to it OneStory stays mounted while j and k move between stories, so the story someone pressed m on stayed in noteOn, and startNote turned true again on every return to it, focusing the note box and taking the next keys.
This branch has not been deployed
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.
On a story nobody has rendered yet, Write a note on this (
m) renders the story and then opens its note box, asdocs/specs/ui.mdsays. After that, though, the note box took focus again every time someone came back to that story withj/k, so the next keys went into the text box instead of moving through stories. This PR makes the request apply once:OneStorydrops it as soon as someone moves to another story.Cause.
StoriesRoutesrendersOneStorywithout a key, so the component and its state stay mounted across stories.noteOnwas set inStoriesScreen.tsxand never cleared, sostartNote={noteOn === story}became true again on each return. That re-ran the focus effect inImageCompare.tsx, which depends on[startNote].Fix.
noteOnis reset during render when the story changes, React's pattern for adjusting state when a prop changes. That keepsOneStorymounted, so akeydoesn't refetch the batch on everyj/k.Testing. There's no regression test.
ui/has no component test harness: its vitest suites are non-DOM. Covering this would take a story with aplayfunction drivingStoriesRoutesagainst mockeduseStories/useBatchdata, which no existing story does.pnpm typecheckinui/passes. Found in the nightly survey by reading the code, not from a reported failure.