Replies: 1 comment 2 replies
-
That's the intended behavior in 2.0 but it is basically not possible the way we work today. I mean that is basically the primary async goal of the Solid 2.0. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I think that this discussion should better has its place in core SolidJS repo, but I'm posting it here since this is the current home for the
createAsync
primitive.I think that it makes more sense for
createAsync
to suspend the execusion of its callback if it tries to read from an async signal that is still pending, and to only retry again once that signal's value is available.Here is a code example:
This code currently prints:
where as I think that it makes more sense for it to print:
The behaviour I propose resembles how SolidJS works in suspense contexts. Which reminds me of an API that I thought was missing in SolidJS when I read the docs: The thing being that the only way to provide values for contexts currently in SolidJS is via the Context.Provider component. Where as I think that SolidJs should offer an API to provide context values without involving components. I propose therefore that SolidJS should offer a function (let's call it
withContextValue
) which behaves like:Such an API may turn out to be necessary to make
createAsync
suspend as suggested here, without it requiring us toreach for components just to be able to use suspense contexts.
I'm into something. Right?
Beta Was this translation helpful? Give feedback.
All reactions