fix(Deck): reset build ceiling when applying synced slide state#8
Open
chinesepowered wants to merge 1 commit into
Open
fix(Deck): reset build ceiling when applying synced slide state#8chinesepowered wants to merge 1 commit into
chinesepowered wants to merge 1 commit into
Conversation
The BroadcastChannel handler applied a remote slide + click count but never updated curMax. Local navigation via go() resets curMax to the target slide's registered maximum; the remote path skipped that, and because registerMax only ever raises curMax, the synced/audience tab carried the previous slide's ceiling forward. After the presenter jumped between slides, hasNext/hasPrev and the prev/next arrows on the synced tab could be wrong (e.g. Next stayed enabled at the end of a slide with fewer builds). Mirror go() by setting curMax to max(registered max for the incoming slide, incoming clicks).
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.
What
The presenter/audience
BroadcastChannelhandler applies a remote slide and click count, but never updatescurMax(the per-slide build ceiling):Local navigation through
go()always resetscurMaxto the incoming slide's registered maximum. The remote path skips that, and sinceregisterMaxonly ever raisescurMax, the synced tab carries the previous slide's ceiling forward.The effect: after the presenter jumps between slides,
hasNext/hasPrevand the prev/next arrows on the synced tab can be wrong — e.g. Next stays enabled at the true end of a slide that has fewer builds than the one before it.Fix
Mirror
go()in the remote handler: setcurMaxtomax(registered max for the incoming slide, incoming clicks). The incomingclicksis included because the synced tab may not have visited that slide yet (so its registered max is still 0), but it must be able to show the builds the presenter has already revealed. Once the slide renders,registerMaxtops it up to the true maximum if higher.Changes
src/deck/Deck.tsx— setcurMaxalongsideslide/clicksin theBroadcastChannelonmessagehandler.Verification
npx tsc --noEmit✓npm run build✓