Defer not working as expected with the most basic example. It awaits all promises before transmitting data. #8132
Unanswered
felixmpaulus
asked this question in
Q&A
Replies: 2 comments 3 replies
-
It works as expect. https://stackblitz.com/edit/remix-run-remix-cxmhxm?file=app%2Froot.tsx |
Beta Was this translation helpful? Give feedback.
1 reply
-
You should swap the order of your function calls.
// deferred promises should be called first so they can start
// before you await the other promises
const canBeDeferred = slowAndDeferrable(); // start promise
const critical = await quickAndCritical(); // wait until promise resolves |
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
Uh oh!
There was an error while loading. Please reload this page.
-
I have critical data and noncritical data. Both are provided through the loader. I want to transmit the noncritical data as a promise using defer.
Given the following example, I would expect "quickAndCritical" to be rendered after about 1s and "slow" about 2s later.
But actually the page stays blank for about 3s and then renders both.
Am I making a mistake here? I would appreciate any help!
Beta Was this translation helpful? Give feedback.
All reactions