Step history on the single-crystal and PDF pages (+ PDF reopen-result fix, uniform Reset) - #14
Merged
Merged
Conversation
One `stepHistory` binding (historyBinding.ts) now serves all three engines; the shell snapshots whichever engine is active, as Save does, and going back reuses the Open path (which remounts the SC / PDF engine from the step). - SC: refine / guided / prefit / escape, magnetic model applied or removed, Reset. PDF: refine / prefit / escape, boxcar-box adopt, distortion modes (parent CIF, subgroup, mode activation), spin model adopted / shown / removed, Reset. Loading SC or PDF data starts a new history. - Requested steps are recorded a tick after they render, so an engine that settles its state in its own effects (the PDF spec-swap carryover) is captured settled, not half-updated. - Reset on SC and PDF now restores starting values and keeps every row and free/fixed choice, as powder does. SC Reset used to rebuild from the fresh spec, dropping applied moment rows while the magnetic model stayed set. Fix: a reopened PDF project lost its last result in development. StrictMode runs a mount effect twice; the spec-swap effect's second run took the mount spec for a model change and cleared the result. The effect is now idempotent per spec. The history exposed it as phantom "No change" steps. Verified in the browser: PDF demo → Refine → back → forward gives exactly 2 steps with the result restored; a saved-and-reopened PDF project keeps its result; SC (Eu3In2Te4 .int) load → Refine → Reset → back/forward gives 3 steps and the result returns at s2; powder unchanged. Co-Authored-By: Claude Opus 5.5 <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.
Follows #13 (powder step history).
What
stepHistorybinding (src/app/historyBinding.ts) serves the powder, single-crystal and PDF engines, and the History card takes it directly.Fix found by the history
A reopened PDF project lost its last result in development.
main.tsxruns under StrictMode, which runs mount effects twice. The spec-swap effect's second run took the mount spec for a model change and cleared the result. The effect is now idempotent per spec object. The history exposed this as phantom "No change" steps. Production builds don't run effects twice, so users there were unaffected.Evidence
lastResult. It didn't before the fix..intfromdata/(with its CIF) → Refine → Reset → back/forward gave 3 steps (load, Refine, Reset), with the result back at s2 and no phantom steps.tsc -bandeslint .are clean.Notes
performancenavigation typenavigate, no Vite reload). Both times the pane's viewport emulation was on. The app has no navigation code, and autosave restored the session both times. Documented here in case anyone sees it outside the pane.🤖 Generated with Claude Code