-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: server-side client state persistence #8314
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
Open
psychedelicious
wants to merge
11
commits into
main
Choose a base branch
from
psyche/feat/app/client-state-persistence
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
psychedelicious
added a commit
that referenced
this pull request
Jul 21, 2025
We intermittently get an error like this: ``` TypeError: Cannot read properties of undefined (reading 'length') ``` This error is caused by a `redux-undo`-enhanced slice being rehydrated without the extra stuff it adds to the slice to make it undoable (e.g. an array of `past` states, the `present` state, array of `future` states, and some other metadata). `redux-undo` may need to check the length of the past/future arrays as part of its internal functionality. These keys don't exist so we get the error. I'm not sure _why_ they don't exist - my understanding of `redux-undo` is that it should be checking and wrapping the state w/ the history stuff automatically. Seems to be related to `redux-remember` - may be a race condition. The solution is to ensure we wrap rehydrated state for undoable slices as we rehydrate them. I discovered the solution while troubleshooting #8314 when the changes therein somehow triggered the issue to start occuring every time instead of rarely.
4 tasks
psychedelicious
added a commit
that referenced
this pull request
Jul 21, 2025
We intermittently get an error like this: ``` TypeError: Cannot read properties of undefined (reading 'length') ``` This error is caused by a `redux-undo`-enhanced slice being rehydrated without the extra stuff it adds to the slice to make it undoable (e.g. an array of `past` states, the `present` state, array of `future` states, and some other metadata). `redux-undo` may need to check the length of the past/future arrays as part of its internal functionality. These keys don't exist so we get the error. I'm not sure _why_ they don't exist - my understanding of `redux-undo` is that it should be checking and wrapping the state w/ the history stuff automatically. Seems to be related to `redux-remember` - may be a race condition. The solution is to ensure we wrap rehydrated state for undoable slices as we rehydrate them. I discovered the solution while troubleshooting #8314 when the changes therein somehow triggered the issue to start occuring every time instead of rarely.
63cab3f
to
d0d4783
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api
frontend
PRs that change frontend files
frontend-deps
PRs that change frontend dependencies
python
PRs that change python files
python-tests
PRs that change python tests
services
PRs that change app services
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.
Summary
Move client state persistence from browser to server.
JsonValue
. The client is expected to handle all data parsing/validation (it must do this anyways, and does this today).redux-remember
enhancer was added last in the enhancer chain, which prevented us detecting when a persist has succeeded. This required a small change to theunserialze
utility (used during rehydration) to ensure slices enhanced withredux-undo
are set up correctly as they are rehydrated.store.ts
file. Oh well.Implications:
Reset Web UI
to fix it (or otherwise hit the appropriate endpoint). It may be possible to end up in a Catch-22 where you can't click the button and get stuck w/ a borked studio - I think to think through this a bit more, might not be an issue.Other notes:
invokeai.yaml
setting or maybe in the UI. This would temporarily disable persistence. Actually, I don't think this really makes sense, bc all the images would be saved to disk.Related Issues / Discussions
n/a
QA Instructions
Try it out. It's pretty straightforward. Error states are the main things to test - for example, network blips. The new server-side persistence driver is the only real functional change - everything else is just kinda shuffling things around to support it.
Merge Plan
n/a
Checklist
What's New
copy (if doing a release after this PR)