Remove defer implementation in favor of raw promises#11744
Conversation
🦋 Changeset detectedLatest commit: 5721631 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4aaa8a8 to
9312705
Compare
| resolvedUndefined: new Promise( | ||
| (resolve) => setTimeout(() => { | ||
| resolve(undefined); | ||
| }, 10) | ||
| ), | ||
| }); |
There was a problem hiding this comment.
It's fine to resolve with undefined now so removed this aspect of the test
| } | ||
| `, | ||
|
|
||
| "app/routes/headers.tsx": js` |
There was a problem hiding this comment.
Headers aren't special to defer anymore and are tested elsewhere
| test("resolved promises render in initial payload", async ({ page }) => { | ||
| test("resolved promises do not render in initial payload", async ({ |
There was a problem hiding this comment.
Without defer we no longer render resolved promises in the initial shell
| cancelActiveDeferreds( | ||
| (routeId) => | ||
| !(matches && matches.some((m) => m.route.id === routeId)) || | ||
| (matchesToLoad && matchesToLoad.some((m) => m.route.id === routeId)) | ||
| ); |
There was a problem hiding this comment.
It will be up to users to abort their own promises going forward
| activeDeferreds.forEach((deferredData, routeId) => { | ||
| deferredData.subscribe((aborted) => { | ||
| // Note: No need to updateState here since the TrackedPromise on | ||
| // loaderData is stable across resolve/reject | ||
| // Remove this instance if we were aborted or if promises have settled | ||
| if (aborted || deferredData.done) { | ||
| activeDeferreds.delete(routeId); | ||
| } | ||
| }); | ||
| }); |
There was a problem hiding this comment.
No longer needed - promises will settle and be handled in the UI by application code
|
🤖 Hello there, We just published version Thanks! |
No description provided.