-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add end to end test for Suspense #260
Conversation
💥 No ChangesetLatest commit: ed7dcf4 Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂 If these changes should be published to npm, you need to add a changeset. Click here to learn what changesets are, and how to add one. Click here if you're a maintainer who wants to add a changeset to this PR |
@@ -15,7 +15,7 @@ | |||
"archive": "git archive --format zip --output dist/source-code.zip master", | |||
"lint": "eslint 'src/**/*.{ts,tsx}' 'test-e2e/**/*.ts'", | |||
"test": "mochette -c tsconfig.cjs.json 'src/**/*.test.{ts,tsx}'", | |||
"test-e2e": "TS_NODE_PROJECT=tsconfig.cjs.json yarn ts-node test-e2e/run.ts --default-timeout 2000", | |||
"test-e2e": "TS_NODE_PROJECT=tsconfig.cjs.json ts-node test-e2e/run.ts --default-timeout 2000", |
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.
Good catch 👍
Took a look why the --- a/src/adapter/10/vnode.ts
+++ b/src/adapter/10/vnode.ts
@@ -57,8 +57,13 @@ export function hasDom(x: any): boolean {
*/
export function isSuspenseVNode(vnode: VNode): boolean {
const c = getComponent(vnode) as any;
- // FIXME: Mangling of `_childDidSuspend` is not stable in Preact
- return c != null && c._childDidSuspend;
+ return !!(
+ c != null &&
+ (c._childDidSuspend || // < Preact 10.3.0, mangling name was unstable
+ // >= Preact 10.3.0
+ c._pendingSuspensionCount ||
+ c.__u)
+ );
}
/**
@@ -185,6 +190,11 @@ export function getDisplayName(vnode: VNode, config: RendererConfig10): string {
return `${ctx.displayName}.Provider`;
}
}
+
+ // Suspense
+ if (isSuspenseVNode(vnode)) {
+ return "Suspense";
+ }
}
return type.displayName || type.name || "Anonymous"; |
@marvinhagemeister Thanks! Had wondered if it was mangling related but not found the right bit of code yet. Your diff does fix the display of
|
a7bdbc6
to
449a04e
Compare
449a04e
to
6c8e464
Compare
@bz2 Agree about landing the change as is. Whenever there is a bit of activity in this repo I tend to roll out releases on a weekly basis and having the proper Regarding your questions:
Ah good point! I've checked it again and we're save to use
I'm a huge fan of splitting work up in chunks. It's totally ok if this PR solves the detection of |
Co-authored-by: Marvin Hagemeister <hello@marvinh.dev>
Basics of a Suspense node appearing are validated, but not yet all details as devtools does not display final children yet.
6c8e464
to
ed7dcf4
Compare
Good news: I've made a branch based of this one and added commits that finish the Suspense integration, se #265. Kept the commit history intact, so the changes in this PR landed with it. Therefore this PR can be closed. Another PR for toggling suspense state is also incoming 👍 |
@marvinhagemeister Amazing! Thanks for chasing down. |
Lack of a Delayed item in the tree appears to be a bug.
Following up from #250 seems
Suspense
is the likely culprit as it also messes up the tree display components. Start of a test to reproduce/validate behaviour. Passes in current form, need to add some validations that fail.