Replies: 1 comment
-
I've come to learn that this component, if updated to the standard and design philosophy of Solid, becomes the Suspense component. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I wasn't sure where to put this, but I made this for a rather large solidjs project. It had a lot of async outbound calls (to servers and services), and I looked through the docs but didn't find any short hands for Await, so this proved really useful rather than handling 10+ resources manually all the time.
It might look a bit arcane, but all it is, is an Await component that takes in any amount of functions (like a vararg) returning a promise of some kind, and a child function (like For) with corresponding inputs. If any 1 function fails, the callback is used instead.
It is strictly a control flow utility, and has no visual "impact" so to speak.
Type safety is, somehow, preserved. Support can also easily be extended for resources' "refresh" through a trigger signal or something like that. Its version here is boiled down to only the parts involving the solidjs standard library as to require less dependencies.
I believe a lot would like a component like this to be part of either the standard library, or solid primitives, but again, don't exactly know where to PR, so let me know.
As for testing, I must admit that this specific version doesn't have its own test suite. We are primarily using descendants of this modified for our specific usecases, however it has been a solid tool (pun intended) for us for months.
Beta Was this translation helpful? Give feedback.
All reactions