vicary
vicary
Explore posts from servers
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
We'll update in the next patch, thanks!
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
No worries because Suspense removes the needs for a Skeleton compoent with fallbacks, we may simply remove it from the example.
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How 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:
<For each={query()....}>
<For each={query()....}>
Do you see a destructuring that we've missed?
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
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
SSolidJS
Created by vicary on 8/1/2024 in #support
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
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Sounds good!
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Yes It shares the same cache. So it is more likely a guide section in our website for solid integration.
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
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
SSolidJS
Created by vicary on 8/1/2024 in #support
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
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
A quick search in tanstack shows <A preload={true} />. Just to make sure I understand, are we talking about that, or is it about the load attribute in <Route />?
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Runtime selection is the default for development phase, we encourage users to add prepare in production. We'll try to integrate this option into preload. Thanks for the heads up!
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
With the prepare option, the fetch can happen onMount. We can make it happen during createQuery if thats what you recommend.
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Thanks!
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Then we won't bother maintaining our own global fetch-promise mapping, Suspense is the way to go!
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Oh, got it. We'll use render and waitFor instead for now. But is that something you'd like to make happen in the future?
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
In fact render 1 is achieved by using batch() with all the refetch() calls across multiple instance of createQuery/createResource.
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Sorry my bad, updating the code snippet.
55 replies
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
In our test:
return testEffect(() => {
const query1 = createQuery();
const query2 = createQuery();
const query3 = createQuery();

createEffect(() => {
query1().data;
query2().data;
query3().data;

// the rest of the test
});
});
return testEffect(() => {
const query1 = createQuery();
const query2 = createQuery();
const query3 = createQuery();

createEffect(() => {
query1().data;
query2().data;
query3().data;

// the rest of the 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
SSolidJS
Created by vicary on 8/1/2024 in #support
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
SSolidJS
Created by vicary on 8/1/2024 in #support
How to create and test a data fetching library?
Yes, we are using p-defer.
55 replies