vicary
Explore posts from serversHow to create and test a data fetching library?
Thank you, it's working properly now! The
.latest
was an attempt to solve a rare case when the UI was locked in a Suspense state, we might have solved it when we refactor the core.
We know that the exact location of function calls is where it triggers reactivity, for example in <Characters />
we do this:
Do you see a destructuring that we've missed?55 replies
How to create and test a data fetching library?
Thanks for confirming the behavior! But I am afraid we may need some help in pinning down the root cause of leaking suspenses.
In the screen recording you can see there is a Suspense fallback at the first fetch, and the glimmer at the second fetch means the Suspense failed to show up.
1. This is the location of <Suspense />
2. And this is the createResource() where we returns the fetch promise
What would be the best place to start looking?
55 replies
How to create and test a data fetching library?
Hi @Brendonovich! We are hitting an interesting situation when we're doing some e2e tests.
When we update a filter on the data-table during an active fetch (i.e. Suspense fallback is visible), the UI seems to be locked in the Suspense fallback.
We are suspecting a call to
refetch
before resolving a pending promise in createResource
triggers this issue.
I am curious if there is a way to "cancel" or "break free" from a stale pending promise, such that we don't have to queue up these UI state changes after the pending promise.55 replies
How to create and test a data fetching library?
Sounds like our RSC approach, users would have to use
resolve
in GQty core for preloading, i.e. users should call resolve()
in your loadUser
example for <Route preload={loadUser} />
.
Feels like not really possible with an option createQuery
in @gqty/solid
alone, am I correct?55 replies
How to create and test a data fetching library?
start fetching without running the component with prepare
We are doing this inside onMount
, the fetch starts before any JSX. Do we need to further hoist it up to run synchronously during createQuery
?55 replies
How to create and test a data fetching library?
In our test:
We see 4 updates as follows, while we want 2.
1. all starts loading
2. query1 resolves
3. query2 resolves
4. query3 resolves
It's kind of a final stretch for DX and testing though, users shouldn't notice the perf difference.
55 replies
How to create and test a data fetching library?
It is possible for us to maintain a fetch -> query mapping of all the active promises, such that correlated fetchers would return the same promise instance. I am quite confident that it would work.
I am just curious if there is some easier ways to batch them up, we are able to restrict all of them to the very next microtask.
55 replies