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

ui: redesign followups 8 #5445

Merged
merged 14 commits into from
Jan 8, 2024
Merged

ui: redesign followups 8 #5445

merged 14 commits into from
Jan 8, 2024

Conversation

psychedelicious
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Have you discussed this change with the InvokeAI team?

  • Yes
  • No, because:

Have you updated all relevant documentation?

  • Yes
  • No

Description

Minor fixes/enhancements:

  • disable cancel queue hotkeys in input elements (prevented you from typing uppercase X)
  • default scale mode is now auto, closes [enhancement]: Scale before processing should be Auto by default #5439
  • fix embedding popover not capturing focus while loading TIs, closes [bug]: Typing quickly while embeddings are loading uses hotkeys #5442
  • enable control adapter autoconfig when switching the ca model, closes [enhancement]: Controlnet Models should reset "auto processing" when switched #5440
  • use JSON.stringify for roarr error message serializer (fixes new issue w/ truncated contexts in console)
  • add $socket to window when in dev mode to assist in debugging
  • simplify redux actions related to sockets, may save us a few microseconds but more importantly its much cleaner
  • add debuggingLoggerMiddleware. similar to redux devtools, but devtools will only keep the latest however many actions. browser console has much higher history. this must be manually added to middleware to enable.
  • bump deps
  • add error handling for redux-remember persist/rehydrate actions (better visibliity when there is a problem)
  • add migrations for persisted redux state, fixes issue with UI crash after app update. This is a bare-bones implementation with no type safety within the migration logic. In the future we might want to model app state w/ a schema/zod to get better safety. There is, however, good type safety surrounding the migration logic, ensuring that persisted slices are set up properly.

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

The most important thing to test is that upgrades do not crash the UI. Note that this fix only works for v3.5.1 to v3.6.0 and onward. This will not fix other occurrences of the issue when updating from earlier version.

To reproduce the issue:

  • Check out tag v3.5.1
  • Run UI in dev mode
  • Reset web UI
  • Kill dev server
  • Check out main
  • Run UI in dev mode
  • Refresh browser

You should get an error: TypeError: Cannot read properties of null (reading 'id')

Then, to test this PR:

  • Reset web UI
  • Redo the steps above, except instead of main, check out this PR branch

You should get no error and the app loads fine.

Merge Plan

This PR can be merged when approved. Please reproduce the crash and fix as described above before approving.

There's no need to have `socket...` and `appSocket...` actions.

I did this initially due to a misunderstanding about the sequence of handling from middleware to reducers.
Mainly bumping to get latest `redux-remember`.

A change to socket.io required a change to the types in `useSocketIO`.
- Add an error handler to `redux-remember` config using our logger
- Add custom errors representing storage set and get failures
- Update storage driver to raise these accordingly
- wrap method to clear idbkeyval storage and tidy its logic up
This simply logs every action and a diff of the state change.

Due to the noise this creates, it's not added by default at all. Add it to the middlewares if you want to use it.
A recent change to ROARR introduced limits to the size of data that will logged. This ends up making our logs far less useful. Change the serializer back to what it was previously.
The previous diff library would present deleted things as `undefined`. Unfortunately, a JSON.stringify cycle will strip those values out. The ROARR logger does this and so the diffs end up being a lot less useful, not showing removed keys.

The new diff library uses a different format for the delta that serializes nicely.
- All persisted slices must now have a slice config, consisting of their initial state and a migrate callback. The migrate callback is very simple for now, with no type safety. It adds missing properties to the state. A future enhancement might be to model the each slice's state with e.g. zod and have proper validation and types.
- Persisted slices now have a `_version` property
- The migrate callback is called inside `redux-remember`'s `unserialize` handler. I couldn't figure out a good way to put this into the reducer and do logging (reducers should have no side effects). Also I ran into a weird race condition that I couldn't figure out. And finally, the typings are tricky. This works for now.
- `generationSlice` and `canvasSlice` both need migrations for the new aspect ratio setup, this has been added
- Stuff related to persistence has been moved in to `store.ts` for simplicity
Prevents hotkeys from being captured when embeddings are still loading.
@maryhipp maryhipp merged commit 0fc08bb into main Jan 8, 2024
7 checks passed
@maryhipp maryhipp deleted the feat/ui/redesign-followups-8 branch January 8, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants