Releases: lxsmnsyc/graph-state
Releases · lxsmnsyc/graph-state
New Core
graph-state
- Deprecation of the ff. functions:
createGraphDomainMemory
->createMemory
createGraphNode
->node
createGraphNodeFactory
->factory
getGraphNodeState
->get
runGraphNodeDispatch
->dispatch
runGraphNodeCompute
->reset
hydrateGraphNodeState
->hydrate
setGraphNodeState
->set
subscribeGraphNode
->subscribe
destroyGraphDomainMemory
->destroyMemory
hasGraphNode
->exists
getGraphNodeVersion
->version
createGraphNodeResource
->resource
createGraphNodeResourceFactory
->resourceFactory
Use of these old function names are still supported, but marked as @deprecated
.
GraphNodeGetInterface
andGraphNodeSetInterface
has been renamed toGraphNodeContext
- nodes with custom
set
defined can now return any value. With this change,set
is no longer subject to race conditions. It is recommend to usesubscription
to work-around this problem. mutate
,mutateSelf
andset
can now accept derived states (callbacks that receives the previous state and returns the new state).- Added
subscription
toset
context. Subscriptions are cleaned-up every timeset
is 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-adapter
andreact-scoped-model
- Added
useGraphNodeSelector
preact-graph-state
- Update README
- Migrated core to
preact-store-adapter
andpreact-scoped-model
- Added
useGraphNodeSelector
swr-graph-state
- Migrated core to
swr-store
- Removed
fetch
option in favor of the newsetup
option. - Removed
hydrate
- Deprecated the ff.
createSWRGraphNode
->swr
createSWRGraphNodeFactory
->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.
set
can now accept async functions, in turn, dispatch calls to the graph node can now also be awaited.- Added
resetSelf
to graph node contexts (bothget
andset
). - Added
resolve
to graph node contexts (bothget
andset
): 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
shouldUpdate
tocreateGraphNode
.shouldUpdate
allows 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
hasNode
andhasNodeState
toGraphDomainInterface
.
react-graph-state
- Adds
useGraphNodeHydrate
preact-graph-state
- Adds
useGraphNodeHydrate
swr-graph-state
- Adds
subscribe
andhydrate
global functions. - Deprecates
option.ssr
andoption.useOwnCache
. All SWR Graph Nodes now share the same cache. - Adds
subscribe
andhydrate
to SWR Graph Node methods. - Restructured revalidation core.