Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist state #136

Merged
merged 20 commits into from
Nov 24, 2024
Merged

Persist state #136

merged 20 commits into from
Nov 24, 2024

Conversation

richardolsson
Copy link
Member

@richardolsson richardolsson commented Oct 13, 2024

This PR intends to resolve #30.

This contained a known bug:

When there are multiple projects, the state from store.json doesn't get loaded into all projects if the user only interacts with one of them. This means that data can get lost, if a user updates one project without first visiting all projects.

6ac5ceb tries to fix the bug

webapp/src/store/Store.ts Outdated Show resolved Hide resolved
webapp/src/store/Store.ts Outdated Show resolved Hide resolved
webapp/src/store/Store.ts Show resolved Hide resolved
webapp/src/store/Store.ts Show resolved Hide resolved
Base automatically changed from issue-25/merge-store-data to main October 19, 2024 11:50
Normally, Node modules are only loaded once which makes module variables
just as persistent as a globalThis property.

With hot-loading, it isn't safe to store the old implementation's
instance anyway. For Lyra in dev moce, reinitializing seems OK to me,
especially with the disk persisted state.
Testing reveals that Next does something fishy. It seems server actions
use a separate module tree in development mode.
With webapp/store.json in the root gitignore, prettier fails to ignore,
possibly because it evaluates the patterns relative to its working dir.
webapp/src/store/Store.ts Outdated Show resolved Hide resolved
@WULCAN WULCAN marked this pull request as ready for review October 19, 2024 19:51
@WULCAN
Copy link
Collaborator

WULCAN commented Oct 27, 2024

Thank you, @amerharb

I have reviewed up to and including 23ddabe and approve that for merging but I still want someone to review my changes 3a6dfc9 -- 6ac5ceb

@WULCAN WULCAN merged commit ff72fc1 into main Nov 24, 2024
1 check passed
@WULCAN WULCAN deleted the issue-30/persist-state branch November 24, 2024 10:30
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.

Persist backend state across server restarts
3 participants