Solid.Router.Action
- Package
- purescript-purs-solid
- Repository
- arazorda/purs-solid
Router actions: mutations the router tracks. When one finishes the router
applies its Reply (redirect, revalidation) and, unless the reply says
otherwise, revalidates every query on screen. Forms can post to one
(H.form { action: formAction save, method: POST }), which works before
hydration too. For transactional steps and optimistic values, see
Solid.Action.
#RouterAction Source
data RouterAction t0 t1#routerAction Source
routerAction :: forall a b. String -> (a -> Aff (Reply b)) -> RouterAction a bname identifies the action (and its form URL); make it unique.
#serverAction Source
serverAction :: forall a b. Serializable a => Serializable b => ServerFunction a (Reply b) -> RouterAction a bA server function as a router action, identified by the server function;
its Reply travels in the response.
#formAction Source
formAction :: forall b. RouterAction FormData b -> StringThe URL a <form method="post"> posts to. The router submits the form's
FormData.
#useAction Source
useAction :: forall a b. RouterAction a b -> Setup (a -> Aff (Maybe b))Runs the action. Nothing when it replied with a redirect or a reload.
Router 2 deprecates programmatic form action calls. Use a form for
tracked submissions or call a server function or Solid.Action directly.
#useSubmissions Source
useSubmissions :: forall a b. RouterAction a b -> Setup (Accessor (Array (Submission a b)))#Submitting Source
newtype Submitting aRuns as a submission starts, inside its transaction: make optimistic writes
here (Solid.Action.setOptimistic, Solid.Store.updateOptimistic).
Instances
#onSubmit Source
onSubmit :: forall a b. (a -> Submitting Unit) -> RouterAction a b -> RouterAction a b#onSettled Source
onSettled :: forall a b. (Submission a b -> Effect Unit) -> RouterAction a b -> RouterAction a bRuns after every submission, including redirects and ones with no result.
- Modules
- Solid.
Action - Solid.
Async - Solid.
Component - Solid.
Component. JS - Solid.
Context - Solid.
Control - Solid.
DOM - Solid.
DOM. Aria - Solid.
DOM. AttrValue - Solid.
DOM. HTML - Solid.
DOM. SVG - Solid.
Errors - Solid.
Internal. Action - Solid.
Internal. Equality - Solid.
Internal. Identity - Solid.
Internal. Names - Solid.
Internal. Optimistic - Solid.
Internal. Props - Solid.
Internal. Reply - Solid.
Internal. Serializable - Solid.
Internal. ServerFunction - Solid.
Internal. Setup - Solid.
Internal. Store - Solid.
Internal. Tracked - Solid.
Internal. View - Solid.
JSX - Solid.
Lifecycle - Solid.
Meta - Solid.
Owner - Solid.
Reactivity - Solid.
Root - Solid.
Router - Solid.
Router. Action - Solid.
Router. Path - Solid.
Router. Query - Solid.
Router. Search - Solid.
Setup - Solid.
Signal - Solid.
Start. Middleware - Solid.
Start. RequestEvent - Solid.
Start. Response - Solid.
Start. ServerFunction - Solid.
Start. UseServer - Solid.
Store - Solid.
Testing - Solid.
Utility - Solid.
Web - Solid.
Web. SSR