Module

Solid.Router.Query

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

Cached loaders keyed by name and argument. Define them at the top level with unique names; runQuery must be the first step of an Aff read by createAsync, so the cache sees who is reading it:

items /\ _ <- createAsync (runQuery stories <$> args)

#Query Source

data Query t0 t1

#query Source

query :: forall a b. Serializable a => Serializable b => String -> (a -> Aff b) -> Query a b

#queryServer Source

queryServer :: forall a b. Serializable a => Serializable b => ServerFunction a b -> Query a b

Named by the server function; the client calls it with a GET.

#runQuery Source

runQuery :: forall a b. Query a b -> a -> Aff b

From the cache when it's fresh, loading it otherwise.

#prefetch Source

prefetch :: forall a b. Query a b -> a -> Effect Unit

Starts loading a value into the cache, e.g. from a route's preload.

#QueryKey Source

newtype QueryKey

Names cached values: all of a query's, or one argument's. Also what a Solid.Start.Response.Reply revalidates.

Instances

#queryKey Source

queryKey :: forall a b. Query a b -> QueryKey

#queryKeyFor Source

queryKeyFor :: forall a b. Query a b -> a -> QueryKey

#revalidate Source

revalidate :: forall a b. Query a b -> Effect Unit

Marks every cached value of a query stale and reloads the ones on screen.

#revalidateWith Source

revalidateWith :: forall a b. Query a b -> a -> Effect Unit

Marks one argument's cached value stale and reloads it if it's on screen.

#revalidateAll Source

revalidateAll :: Effect Unit

Marks every cached query value stale, and reloads the ones on screen.

Re-exports from Solid.Internal.Serializable

#Serializable Source

class Serializable a 

Types that survive Solid's serialization unchanged: primitives, Unit, Nullable, Json, arrays, objects and records of them. A newtype over one can derive it (derive newtype instance Serializable UserId). ADTs lose their constructors, so they need an explicit codec.

Instances