pixiebrix-extension
pixiebrix-extension copied to clipboard
PackageRegistry - Add capability to fetch single items from the API if they don't exist in the IDB cache
User Story
As a page editor user and someone giving page editor demos, I don't want to have to wait for the entire registry to load in the background before my UI is unblocked to use
Motivation
Follows on from #7064 & #7183
Implementation Sketch
- Add an options object to the package registry
find()function, with cache options (e.g. - "cache-only", "prefer-fetch", "force-fetch"), for now default to current behavior (cache-only) - Add tests for cache strategies
Future Work
- We'll start cutting over various usages of
packageRegistry.find(),useAllModDefinitions(), and othersyncRemote()calls to make individual lookups by id from the registry, with cache options appropriate for each use case - We will need to do some product/UX thinking around cache invalidation as well, i.e. when and where in the product would users expect to see mods, bricks, integrations, etc. updated/refreshed from the server?