Conversation
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.
Story IDs key every saved result. They were host-local state that never crossed
the wire, which broke in three places at once:
undefined.state-syncrebuilds statefield by field and omitted
storyIds/storyId, so every path that indexesthem threw —
renderWaiting,startVoting,loadStories.stories-loadcarried the stories without their IDs. The receiverreplaced its list and kept the old IDs, leaving the two arrays misaligned:
results attached to the wrong story.
storyIdwas only maintained instartVoting. AfternextStory()itstill pointed at the previous story — on the host too, not just on peers.
The fix removes the field rather than patching each site:
storyIdis nolonger stored, it is derived from
currentIndexwhen the state is read, so itcannot drift out of step.
storyIdsnow travels with the stories itidentifies, and incoming lists are rebuilt to the same length as the stories —
an unusable ID is replaced in place, never dropped, since dropping would shift
every later ID onto the wrong story.
Nine tests, including the regression for the
undefinedstate-sync. The reasonthis shipped is worth recording: there was not a single test that mentioned
storyId.