Skip to content

Conversation

@sverhoeven
Copy link
Collaborator

@sverhoeven sverhoeven commented Nov 24, 2025

Persist analyses in local storage and in state file via share dialog when state is too big.

For example http://localhost:3000#%7B%22exper.... should load 5 analysis with 3 vertical profiles with temperature, relative humidity and potential temp vars selected.

Fixes #189

@sverhoeven sverhoeven changed the base branch from main to plot-more-observation-vars-184 November 24, 2025 13:54
@sverhoeven sverhoeven changed the base branch from plot-more-observation-vars-184 to remote-exp November 24, 2025 13:55
@sverhoeven sverhoeven changed the base branch from remote-exp to plot-more-observation-vars-184 November 24, 2025 13:55
@sverhoeven sverhoeven requested a review from Copilot November 24, 2025 14:00
@sverhoeven sverhoeven changed the base branch from plot-more-observation-vars-184 to main November 24, 2025 14:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements persistence for analyses by storing them in local storage and in the state file. The main changes involve extracting analysis type definitions into a dedicated module, adding validation/parsing for analyses, and updating the state encoding/decoding logic to handle analyses.

  • Refactors analysis types into a separate analysis_type.ts module with validation
  • Adds analysis encoding/decoding in the state management
  • Fixes a template literal bug and adds support for additional profile variables (rh, T, p)

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/class-solid/src/routes/index.tsx Updates imports to use analysisNames from the new analysis_type module
apps/class-solid/src/lib/store.ts Removes analysis type definitions (moved to analysis_type.ts) and adds setAnalyses call in loadStateFromString
apps/class-solid/src/lib/profiles.ts Fixes template literal syntax bug and adds support for rh, T, and p variables in observation profiles
apps/class-solid/src/lib/encode.ts Adds analysis parsing/encoding to state serialization functions
apps/class-solid/src/lib/analysis_type.ts New file defining analysis types with JSON Schema validation for parsing persisted analyses
apps/class-solid/src/components/Analysis.tsx Updates imports to use analysis types from analysis_type module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sverhoeven sverhoeven requested a review from Peter9192 November 24, 2025 14:04
@Peter9192
Copy link
Member

Persistence of analysis works, but one thing that strikes me is that all close model runs are deselected in the legend when first rendered. I need to turn all of them on manually. Might related to #178.

@Peter9192
Copy link
Member

Peter9192 commented Nov 24, 2025

Does this only work with URL or also in a JSON config? And could we combine that? class-model.github.io/class-web?s=aabcde&analysis=....

@sverhoeven
Copy link
Collaborator Author

Does this only work with URL or also in a JSON config? And could we combine that? class-model.github.io/class-web?s=aabcde&analysis=....

When you make a share link with state in the URL (.../class-web#<json encoded state works>) then that state now also includes analysis now. The save session to local storage, save to state.json file and state in URL all use the same function to make the state and are loaded in the same way.

@sverhoeven
Copy link
Collaborator Author

Persistence of analysis works, but one thing that strikes me is that all close model runs are deselected in the legend when first rendered. I need to turn all of them on manually. Might related to #178.

Indeed looks like the checkbox states are stored in the analyse object, but just locally in the component.

@sverhoeven sverhoeven merged commit 1bd28d2 into main Nov 27, 2025
4 checks passed
@sverhoeven sverhoeven deleted the persist-analyis-189 branch November 27, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When sharing state via URL of file also share analysis

3 participants