Fix Solve Mode animation and stability#76
Conversation
|
PR Stats:
Tips for large PRs:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5d561e3ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @StateObject private var rendererBridge: SolveModeRendererBridge | ||
| @StateObject private var viewModel: SolveModeViewModel | ||
|
|
||
| @SceneStorage("solve_mode_step_index") private var persistedStepIndex = 0 |
There was a problem hiding this comment.
Namespace persisted step index by solve session
Using a fixed @SceneStorage("solve_mode_step_index") key causes progress from one cube/solution to be restored into unrelated Solve Mode sessions, so opening a new solve can jump to an arbitrary step (or directly to solved if the stored index exceeds the new move count). This corrupts guided playback for users who run multiple solves in one app session; the storage key should be scoped to the specific puzzle/solution (or cleared when starting a new solve).
Useful? React with 👍 / 👎.
| guard !didRestoreState else { return } | ||
| didRestoreState = true | ||
|
|
||
| guard persistedStepIndex > 0 else { return } | ||
| viewModel.jump(to: persistedStepIndex) |
There was a problem hiding this comment.
Defer restore completion until orientation lock is cleared
This marks restoration as done before attempting jump, but jump is a no-op while orientationConfirmed is false (SolveModeViewModel.jump guards on that), so any view using requireOrientationConfirmation can never actually restore persisted progress after the user confirms orientation. In practice, users always restart at step 0 despite a saved index; restoration should run again after confirmation or only set didRestoreState after a successful jump.
Useful? React with 👍 / 👎.
Summary:
Testing: