fix(SDK-1211): freeze PaySchedule's initial routing decision - #2703
Merged
mariechatfield merged 1 commit intoSep 4, 2026
Conversation
Recomputing initialState/initialComponent from live query data on every render mints a new machine reference the moment the first schedule is created, which causes robot-hooks to reset and permanently orphan the interpreter — every click after that point becomes a silent no-op. Freeze the decision on mount instead, matching the pattern already used in Compensation.tsx. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mariechatfield
commented
Sep 3, 2026
| defaultValues, | ||
| }), | ||
| ), | ||
| [companyId, defaultValues, initialState, initialComponent], |
Contributor
Author
There was a problem hiding this comment.
The dependencies already existed, but before they were on values that would change at render after the first schedule was created -- and that would break the state machine
However, due to some funk with StrictMode, this sometimes locally appeared to work while it always appeared broken in production, or with strict mode off 🤷🏻
mariechatfield
marked this pull request as ready for review
September 3, 2026 23:26
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
mariechatfield
deleted the
fix/marie/SDK-1211-pay-schedule-state-machine
branch
September 4, 2026 17:04
Merged
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.
Summary
PaySchedule.tsxrecomputedinitialState/initialComponentfrom live query data every render, so the moment the first schedule is created and the query refetches, the machine gets a new reference mid-session.robot-hooks'useMachinetreats any machine-reference change as a full reset, and the reset permanently orphans the interpreter — every click after that point (Edit, Add another, etc.) becomes a silent no-op.Compensation.tsx.Test plan
remains interactive after creating the first schedule) that starts with zero schedules, creates one, and confirms Edit still works afterward. Fails onmain, passes with this fix.npm run test -- --run src/components/Company/PaySchedule/PaySchedule.test.tsx— 28/28 passingnpm run test -- --run src/components/Company src/components/Flow— 224/224 passing, no regressionsnpx tsc --noEmit/npx eslintclean on changed files🤖 Generated with Claude Code