Releases: lxsmnsyc/graph-state
Releases · lxsmnsyc/graph-state
New Core
graph-state
- Deprecation of the ff. functions:
createGraphDomainMemory->createMemorycreateGraphNode->nodecreateGraphNodeFactory->factorygetGraphNodeState->getrunGraphNodeDispatch->dispatchrunGraphNodeCompute->resethydrateGraphNodeState->hydratesetGraphNodeState->setsubscribeGraphNode->subscribedestroyGraphDomainMemory->destroyMemoryhasGraphNode->existsgetGraphNodeVersion->versioncreateGraphNodeResource->resourcecreateGraphNodeResourceFactory->resourceFactory
Use of these old function names are still supported, but marked as @deprecated.
GraphNodeGetInterfaceandGraphNodeSetInterfacehas been renamed toGraphNodeContext- nodes with custom
setdefined can now return any value. With this change,setis no longer subject to race conditions. It is recommend to usesubscriptionto work-around this problem. mutate,mutateSelfandsetcan now accept derived states (callbacks that receives the previous state and returns the new state).- Added
subscriptiontosetcontext. Subscriptions are cleaned-up every timesetis dispatched. - node hydration no longer runs the initial computation before setting the hydration value.
- Removed type declarations for context fields. They are now defined directly in the field.
- Renamed most types.
- Updated README
react-graph-state
- Update README
- Migrated core to
react-store-adapterandreact-scoped-model - Added
useGraphNodeSelector
preact-graph-state
- Update README
- Migrated core to
preact-store-adapterandpreact-scoped-model - Added
useGraphNodeSelector
swr-graph-state
- Migrated core to
swr-store - Removed
fetchoption in favor of the newsetupoption. - Removed
hydrate - Deprecated the ff.
createSWRGraphNode->swrcreateSWRGraphNodeFactory->swrFactory
v1.5.0
graph-state
- Remapped package exports.
- Graph node keys are now DEV-only: user-defined keys are only used in development environments, which are replaced by an internally unique key in production.
setcan now accept async functions, in turn, dispatch calls to the graph node can now also be awaited.- Added
resetSelfto graph node contexts (bothgetandset). - Added
resolveto graph node contexts (bothgetandset): a function that wraps a Promise and produces a lifecycle-dependent Promise which does not resolve if the graph node re-computes before it finishes its previous operation. - Reworked internal batching to not unwind the effects queue but rather let the provided batcher to enqueue on itself.
- Added
shouldUpdatetocreateGraphNode.shouldUpdateallows graph nodes to "memoize": dependent nodes won't get notified if the new state is "equal" to its previous state, preventing cascades.
preact-graph-state
- Remapped package exports
- Removed
generateKey - Updated batching logic to enqueue batched updates and run all of it during commit phase.
react-graph-state
- Remapped package exports
- Removed
generateKey - Updated batching logic to enqueue batched updates and run all of it during commit phase.
swr-graph-state
- Remapped package exports
- Minor renames
v1.4.0
graph-state
- Rewrite core
- Removed state map.
- Fix timing of get and set to synchronized calls.
- Removed work loop.
- Added update batching. Dependent node computation and listeners are now timed differently: Dependent nodes are computed synchronously while listeners are collected and deferred until the custom batcher executes it. The batcher can be customized by provided a batching callback for
createGraphDomainMemory. - Dependent node computation now runs independently whether or not the node wants to notify listeners.
- Add state versions for nodes.
- Removed
GraphDomainInterface. Methods can now be called through globally-defined functions.
react-graph-state
- Added custom batcher.
preact-graph-state
- Added custom batcher.
Hydrate
graph-state
- Adds
hasNodeandhasNodeStatetoGraphDomainInterface.
react-graph-state
- Adds
useGraphNodeHydrate
preact-graph-state
- Adds
useGraphNodeHydrate
swr-graph-state
- Adds
subscribeandhydrateglobal functions. - Deprecates
option.ssrandoption.useOwnCache. All SWR Graph Nodes now share the same cache. - Adds
subscribeandhydrateto SWR Graph Node methods. - Restructured revalidation core.