fix(cluster): dedupe win/explode positions — bonus freeze when a wild is in multiple clusters#32
Open
auraladigital wants to merge 1 commit into
Conversation
A board cell can belong to more than one win — a wild substituting into multiple adjacent clusters lists its position in each. boardWithAnimateSymbols and tumbleBoardExplode store each position's resolver on the symbol via `reelSymbol.oncomplete = resolve`; a duplicate overwrites the prior resolver, so the symbol's single `complete` resolves only the last await — the earlier one never settles, Promise.all hangs, and the round freezes. Dedupe positions by (reel,row) before awaiting in both handlers. Addresses StakeEngine#14. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Addresses #14 ("game sticks when bonus purchase") — a concrete, reproducible cause of the bonus / free-spin freeze.
Cause
A board cell can legitimately belong to more than one win: a wild substitutes into multiple adjacent clusters, so the cluster math lists that cell in each win's
positions. After_.flatten(wins.map(w => w.positions))the cell appears more than once.Board.svelte › boardWithAnimateSymbolsandTumbleBoard.svelte › tumbleBoardExplodestore each position's resolver on the symbol:oncompleteis a single slot. A duplicate position overwrites the first resolver, so the symbol's onecompleteresolves only the last await — the earlier duplicate's promise never settles,Promise.allnever resolves, and the round hangs forever.It only triggers when an event contains a repeated cell (a wild bridging two clusters), which is why it surfaces in bonus and not base, and why the committed Storybook fixtures (
bonus_books.ts— 50 books / 308winInfoevents) don't surface it: none of them happen to contain an overlap. Such events do occur in normal0_0_clustersims.Repro
A
winInfo(or tumble) event whose wins share a cell (illustrative shape):(0,2)is awaited twice → the round never returns to idle.Fix
Dedupe positions by
(reel,row)before building the promise array, in both handlers. A cell is one symbol with oneoncomplete; awaiting it once is correct and the visuals are unchanged.