Invoke Suspense API #1869
CreativeTechGuy
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
createResource works with any async function, you don't need to make fake calls, it is just a function, does not require you to use fetch or anything. Suspense is intended to be used to coordinate loading states. Your use case may not require direct interaction with SuspenseContext, calling the async function triggers it anyway. |
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
-
This is an extension of #451.
Currently, there is no way to trigger suspense aside from
createResource
. This means that if we are doing something custom that doesn't fit increateResource
, the only way to invoke suspense is to add an unnecessary/fake call tocreateResource
just for suspense-purposes despite it not actually being needed. This feels wrong and has a lot of unnecessary overhead.It'd be great if the increment/decrement functions for the internal suspense context are exposed somehow so we can make our own integrations. All of the wiring already exists internally, it could be as simple as exporting
SuspenseContext
.Example: In my situation, all network traffic is done over a single WebSocket connection. A single "request" to the server may result in multiple responses. As a result, this doesn't work with the
createResource
model.TLDR: Can
SuspenseContext
be exported?Beta Was this translation helpful? Give feedback.
All reactions