InvokeAI/invokeai/frontend/web
psychedelicious 23c8a893e1 fix(ui): fix gallery display bug, major lag
- Fixed a bug where after you load more, changing boards doesn't work. The offset and limit for the list image query had some wonky logic, now resolved.
- Addressed major lag in gallery when selecting an image.

Both issues were related to the useMultiselect and useGalleryImages hooks, which caused every image in the gallery to re-render on whenever the selection changed. There's no way to memoize away this - we need to know when the selection changes. This is a longstanding issue.

The selection is only used in a callback, though - the onClick handler for an image to select it (or add it to the existing selection). We don't really need the reactivity for a callback, so we don't need to listen for changes to the selection.

The logic to handle multiple selection is moved to a new `galleryImageClicked` listener, which does all the selection right when it is needed.

The result is that gallery images no long need to do heavy re-renders on any selection change.

Besides the multiselect click handler, there was also inefficient use of DND payloads. Previously, the `IMAGE_DTOS` type had a payload of image DTO objects. This was only used to drag gallery selection into a board. There is no need to hold onto image DTOs when we have the selection state already in redux. We were recalculating this payload for every image, on every tick.

This payload is now just the board id (the only piece of information we need for this particular DND event).

- I also removed some unused DND types while making this change.
2024-01-10 08:22:46 -05:00
..
.storybook feat(ui): memoize all components 2023-12-29 08:26:14 -05:00
config chore(ui): bump deps 2024-01-01 08:13:23 -05:00
docs feat(ui): migrate to pnpm 2023-12-09 16:00:37 +11:00
patches feat(ui): patch reselect to use lruMemoize only 2024-01-06 00:03:07 +11:00
public/locales translationBot(ui): update translation (Chinese (Simplified)) 2024-01-07 01:21:04 +11:00
scripts feat(ui): ux improvements & redesign 2023-12-29 08:26:14 -05:00
src fix(ui): fix gallery display bug, major lag 2024-01-10 08:22:46 -05:00
static/docs feat(api): serve app via route & add cache-control: no-store 2023-10-19 08:52:02 +11:00
tests Partial migration of UI to nodes API (#3195) 2023-04-22 13:10:20 +10:00
__init__.py Run python black 2023-07-28 09:46:44 -04:00
.eslintignore fix(ui): fix workflow editor model selector, excise ONNX 2024-01-03 13:18:50 +11:00
.eslintrc.js feat(ui): more memoization 2023-12-29 08:26:14 -05:00
.gitignore Report ci disk space + minor docker fixes (#5461) 2024-01-10 05:20:26 +00:00
.prettierignore fix(ui): fix workflow editor model selector, excise ONNX 2024-01-03 13:18:50 +11:00
.prettierrc.js feat(ui): migrate theming to chakra ui 2023-03-06 20:03:39 +11:00
.unimportedrc.json feat(ui): ux improvements & redesign 2023-12-29 08:26:14 -05:00
favicon-key.svg fix(ui): fix favicon 2024-01-06 09:09:38 +11:00
favicon-outline.svg fix(ui): fix favicon 2024-01-06 09:09:38 +11:00
index.html fix(ui): fix favicon 2024-01-06 09:09:38 +11:00
package.json ui: redesign followups 8 (#5445) 2024-01-08 09:11:45 -05:00
pnpm-lock.yaml ui: redesign followups 8 (#5445) 2024-01-08 09:11:45 -05:00
tsconfig.json feat(ui): ux improvements & redesign 2023-12-29 08:26:14 -05:00
tsconfig.node.json chore(ui): bump deps 2024-01-01 08:13:23 -05:00
vite.config.mts chore(ui): bump deps 2024-01-01 08:13:23 -05:00