github statelyai/xstate @xstate/store@3.11.0

latest release: @xstate/store@3.11.1
one day ago

Minor Changes

  • #5393 6d00d3f Thanks @davidkpiano! - Add snapshot parameter to getTransactionId function.

    const store = createStore(
      undo(
        {
          // ...
        },
        {
          getTransactionId: (event, snapshot) =>
            snapshot.context.currentTransactionId
        }
      )
    );
  • #5392 5854b52 Thanks @davidkpiano! - Added an overload to useSelector that allows you to select the entire snapshot:

    // No selector provided, return the entire snapshot
    const snapshot = useSelector(store);
  • #5393 6d00d3f Thanks @davidkpiano! - Add skipEvent option to undoRedo() to exclude certain events from undo/redo history.

    const store = createStore(
      undoRedo(
        {
          context: { count: 0 },
          on: {
            inc: (ctx) => ({ count: ctx.count + 1 }),
            log: (ctx) => ctx // No state change
          }
        },
        {
          skipEvent: (event, snapshot) => event.type === 'log'
        }
      )
    );

Don't miss a new xstate release

NewReleases is sending notifications on new releases.