Module

Solid.Action

Package
purescript-purs-solid
Repository
arazorda/purs-solid

Actions: async mutations as one transaction. Every liftAff is a suspension point that re-enters the transaction; nothing is committed until the action finishes. Optimistic values revert when it settles.

#action Source

action :: forall a r. (a -> Action r) -> a -> Aff r

Runs each call as one transaction. Call it from event handlers or other Aff code; Solid rejects actions started in owned scopes.

#Optimistic Source

data Optimistic t0

#createOptimistic Source

createOptimistic :: forall m a. MonadReactive m => a -> m ((Accessor a) /\ (Optimistic a))

A value that can be overridden tentatively during an action and reverts to initial when the action settles.

#createOptimisticWith Source

createOptimisticWith :: forall m a given missing. MonadReactive m => Union given missing (SignalOptions a) => Record given -> a -> m ((Accessor a) /\ (Optimistic a))

Takes any subset of SignalOptions.

#createOptimisticFrom Source

createOptimisticFrom :: forall f a. Tracked f => f a -> Setup ((f a) /\ (Optimistic a))

An optimistic view of source: tentative writes during an action, then back to following source.

#createOptimisticFromWith Source

createOptimisticFromWith :: forall f a given missing. Tracked f => Union given missing (MemoOptions a) => Record given -> f a -> Setup ((f a) /\ (Optimistic a))

Takes any subset of MemoOptions.

#setOptimistic Source

setOptimistic :: forall m a. MonadOptimistic m => Optimistic a -> a -> m Unit

A tentative write: in an Action, or in a router action's onSubmit.

#modifyOptimistic Source

modifyOptimistic :: forall m a. MonadOptimistic m => Optimistic a -> (a -> a) -> m Unit

#affects Source

affects :: forall a. Refresh a -> Action Unit

Marks an async value as pending until the action settles, e.g. before a refresh (which alone doesn't set isPending).

Re-exports from Effect.Aff.Class

#liftAff Source

liftAff :: forall m. MonadAff m => Aff ~> m

Re-exports from Effect.Class

#liftEffect Source

liftEffect :: forall m a. MonadEffect m => Effect a -> m a

Re-exports from Solid.Internal.Action

#Action Source

data Action a

A sequence of steps: effects run inside the transaction, async work suspends it and re-enters it when done.

Instances