InvokeAI/invokeai/frontend
psychedelicious 3db69af220 refactor(ui): generalize stage event handlers
Create intermediary nanostores for values required by the event handlers. This allows the event handlers to be purely imperative, with no reactivity: instead of recreating/setting the handlers when a dependent piece of state changes, we use nanostores' imperative API to access dependent state.

For example, some handlers depend on brush size. If we used the standard declarative `useSelector` API, we'd need to recreate the event handler callback each time the brush size changed. This can be costly.

An intermediate `$brushSize` nanostore is set in a `useLayoutEffect()`, which responds to changes to the redux store. Then, in the event handler, we use the imperative API to access the brush size: `$brushSize.get()`.

This change allows the event handler logic to be shared with the pending canvas v2, and also more easily tested. It's a noticeable perf improvement, too, especially when changing brush size.
2024-06-06 07:45:13 +10:00
..
cli feat(config): add CLI arg to specify config file 2024-03-20 15:05:25 +11:00
install feat(installer): remove updater 2024-03-26 14:48:29 +11:00
web refactor(ui): generalize stage event handlers 2024-06-06 07:45:13 +10:00
__init__.py Run python black 2023-07-28 09:46:44 -04:00