-
Hi all! First off I admit I really have no idea what I'm doing, so feel free to tear apart the code that I have. I have a SvelteKit app (https://github.com/jloh/geojs-app) that does two API calls per request. One of the API calls can be slow and doesn't need to block the other so I've tried to The fast request is the request for I can reproduce this reliably by visiting https://app.geojs.io/ and seeing that the PTR line in the table renders without blocking the other lines in the table but if you then search for another IP, eg Is there a way to do what I'm after? Does using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
SvelteKit will automatically await all top-level promises returned from a load function. This is why rendering is blocked until both promises resolve. If you don't want that behavior, you can nest them in an object so they are no longer at the top level. return {
nested: { // this key can be named anything
geoLookup: geo, // the promise is not at the top level, so it is not automatically awaited
ptrLookup: ptr
}
}; |
Beta Was this translation helpful? Give feedback.
SvelteKit will automatically await all top-level promises returned from a load function. This is why rendering is blocked until both promises resolve.
If you don't want that behavior, you can nest them in an object so they are no longer at the top level.