Suspense triggered witout reading data
So... trying to wrap my head around suspense.
This is based off the "Real word" Solid example:
I have a service with a store which is populated through actions on singin/signup.
I have Login-component with a resource for each of them, signin/up + load data.
The login component doesn't use any of those resources' data itself, but it still "owns" the loading spinner, so Suspense seems a natural candidate.
What would be a idiomatic way to solve/structure this? My cleanest workaround so far is to include a call to a suspense-trigger in the JSX. The trigger is just this:
...but I am not happy with it as it tells me I should be doing stuff differently.
Thanks.
6 Replies
Maybe you would want to consider solid start, as it has route data fetchers that can have properties like loading and state, which would trigger suspense https://start.solidjs.com/api/createRouteData#returns
SolidStart Beta Docuentation
SolidStart Beta Documentation
Early release documentation and resources for SolidStart Beta
route data is a light wrapper over a resource so it would be intuitive to use
Thanks, but at a later time. Now I'm making trendy embedded microsites with solid customElement 😂
The intermediary solution is to skip the spinner, will probably get back to it at a later time
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hmm, couldn't get
createRenderEffect
to work. Could it be cause my Suspense
is in the same component, whereas if it was in a child comp of Supense it will trigger?
A bit more elegant than my last workaround, but still a workaround, I made a const noop = (...args: any[]) => undefined;
and just call that with the triggers as args in the JSX, like <Suspense>{noop(resourceReturn())}</Suspense>
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View