Pullstate

Pullstate

  • Docs
  • GitHub

›Async Actions

Getting Started

  • Installation
  • Quick example
  • Quick example (server rendering)

Reading Store State

  • useStoreState (hook)
  • <InjectStoreState>
  • Subscribe

Updating Store State

  • update()
  • Reactions

Async Actions

  • Introduction
  • Creating an Async Action
  • Use Async Actions
  • Async Action Hooks

    • Hooks overview
    • Post action hook
    • Short circuit hook
    • Cache break hook
  • Other Async Action Options
  • Cache clearing
  • Resolve async state on the server

Dev Tools

  • Redux Devtools

Other Async Action Options

There are some other options we can pass in as the second value when creating Async Actions.

import { createAsyncAction } from "pullstate";

const myAsyncAction = createAsyncAction(action, hooksAndOptions);

Besides hooks, we can also (optionally) pass in:

{
  subsetKey: (args: any) => string;
  forceContext: boolean;
}

subsetKey

This is a function you can pass in, which intercepts the creation of this Async Action's "fingerprint" (or key).

Basically, it takes in the current arguments passed to the action and returns a fingerprint to use in the cache. This could potentially give a performance boost when you are passing in really large argument sets.

forceContext

You can pass in true here in order to force this action to use Pullstate's context to grab its caching and execution state. This is useful if you have defined your Async Action outside of your current project, and without PullstateCore (see "Creating an Async Action" - under "Server-rendered app"). It basically makes an action which might seem "client-only" in its creation, force itself to act like a SSR action, using whatever Pullstate context is available.

← Cache break hookCache clearing →
  • subsetKey
  • forceContext
Pullstate
Docs
InstallationA Quick ExampleMore
Community
GitHub
Pullstate
Created by Paul Myburgh