-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Remove defer implementation in favor of raw promises #11744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to resolve with undefined
now so removed this aspect of the test
@@ -566,23 +532,6 @@ test.describe("non-aborted", () => { | |||
); | |||
} | |||
`, | |||
|
|||
"app/routes/headers.tsx": js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.