You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.
At the moment there is a redux store that is used internally to handle importing of IIIF into a store. Given its lightweight footprint, it has been a good choice for keeping things simple. However it has been challenging to write robust integrations and we are hitting performance ceilings with some IIIF editing use-cases.
At it's core, redux offers the following API (that we use):
import{createStore}from'redux';conststore=createStore(reducer,defaultState);// no middlewarestore.subscribe(()=>{ ... });// Called every time the store changesstore.dispatch(action);store.getState();// Get all state.
This could transition to zustand with very little modification
importcreatefrom'zustand/vanilla';conststore=create({
...defaultState,dispatch: (args)=>set((state)=>reducer(state,args))});store.subscribe(()=>{ ... })// Still called for all statestore.dispatch=store.getState().dispatch;// Slight modification here - although could be temporarystore.dispatch(action);store.getState();// still returns all state
This would then allow for other built-in features from Zustand to be used, like the optimised subscribe:
// only called if manifest changesstore.subscribe((state)=>state.iiif.resources.Manifests[manifestId],handleManifestChange);// only called if manifest label changesstore.subscribe((state)=>state.iiif.resources.Manifests[manifestId].label,handleLabelChange);
and then also gradually change the reducer pattern to use some of Zustands other features (like async actions).
And finally could be easily bound to various Zustand library integrations
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
At the moment there is a redux store that is used internally to handle importing of IIIF into a store. Given its lightweight footprint, it has been a good choice for keeping things simple. However it has been challenging to write robust integrations and we are hitting performance ceilings with some IIIF editing use-cases.
At it's core, redux offers the following API (that we use):
This could transition to zustand with very little modification
This would then allow for other built-in features from Zustand to be used, like the optimised subscribe:
and then also gradually change the reducer pattern to use some of Zustands other features (like async actions).
And finally could be easily bound to various Zustand library integrations
React:
Vue:
Svelte:
Vanilla:
Beta Was this translation helpful? Give feedback.
All reactions