Skip to content

Releases: lxsmnsyc/graph-state

New Core

17 Apr 15:25
Compare
Choose a tag to compare

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 and GraphNodeSetInterface has been renamed to GraphNodeContext
  • 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 use subscription to work-around this problem.
  • mutate, mutateSelf and set can now accept derived states (callbacks that receives the previous state and returns the new state).
  • Added subscription to set context. Subscriptions are cleaned-up every time set 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 and react-scoped-model
  • Added useGraphNodeSelector

preact-graph-state

  • Update README
  • Migrated core to preact-store-adapter and preact-scoped-model
  • Added useGraphNodeSelector

swr-graph-state

  • Migrated core to swr-store
  • Removed fetch option in favor of the new setup option.
  • Removed hydrate
  • Deprecated the ff.
    • createSWRGraphNode -> swr
    • createSWRGraphNodeFactory -> swrFactory

v1.5.0

20 Mar 11:56
Compare
Choose a tag to compare

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 (both get and set).
  • Added resolve to graph node contexts (both get and set): 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 to createGraphNode. 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

14 Dec 13:01
Compare
Choose a tag to compare

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

14 Nov 16:56
Compare
Choose a tag to compare

graph-state

  • Adds hasNode and hasNodeState to GraphDomainInterface.

react-graph-state

  • Adds useGraphNodeHydrate

preact-graph-state

  • Adds useGraphNodeHydrate

swr-graph-state

  • Adds subscribe and hydrate global functions.
  • Deprecates option.ssr and option.useOwnCache. All SWR Graph Nodes now share the same cache.
  • Adds subscribe and hydrate to SWR Graph Node methods.
  • Restructured revalidation core.