Fix machine selection bug in web container #253
+314
−2
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.
Problem
When using happy-web to start a new session, clicking the machine name to change it and then selecting a different machine would cause the selection to revert back to the original machine.
Root Cause
Module-level callback pattern had race conditions in web environments where
router.back()could complete before state updates propagated.Solution
Pass
selectedMachineIdexplicitly via route params when navigating back from machine picker. This ensures the selection is guaranteed to be available when the component mounts.Changes
sources/app/(app)/new/index.tsxto read machine selection from route paramssources/app/(app)/new/pick/machine.tsxto pass machine ID via route paramsmetro.config.jsto exclude test files from web bundle (prevents vitest error)machineSelection.spec.tswith 9 tests covering bug reproduction and fix validationTesting