Skip to content
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

Preact >= 10.18.2 compatability #528

Closed
wants to merge 14 commits into from
4 changes: 4 additions & 0 deletions packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ function replaceComponent(OldType, NewType, resetHookState) {
vnode[VNODE_COMPONENT].constructor = NewType;
}

vnode.type = NewType
vnode[VNODE_COMPONENT].__v = vnode;
vnode[VNODE_COMPONENT].__v.type = NewType;
Comment on lines +101 to +103
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think line 101 & 103 can be removed since they are redundant of each other and line 59.


if (resetHookState) {
if (
vnode[VNODE_COMPONENT][COMPONENT_HOOKS] &&
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/runtime/vnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ options.vnode = vnode => {
}
}

vnode.type = foundType;
// vnode.type = foundType;
if (
vnode[VNODE_COMPONENT] &&
'prototype' in vnode.type &&
vnode.type.prototype.render
) {
vnode[VNODE_COMPONENT].constructor = vnode.type;
vnode[VNODE_COMPONENT].constructor = foundType;
Comment on lines -33 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found undoing this change to fix the failing suspense test

}
}

Expand Down
2 changes: 1 addition & 1 deletion test/fixture/vite-preact-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
"dependencies": {
"goober": "^2.0.36",
"preact": "^10.19.0"
"preact": "10.19.1"
},
"devDependencies": {
"@babel/core": "^7.22.1",
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/vite-signals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
"dependencies": {
"@preact/signals": "^1.1.2",
"preact": "^10.19.0"
"preact": "10.19.1"
},
"devDependencies": {
"@babel/core": "^7.22.1",
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
"dependencies": {
"goober": "^2.0.36",
"preact": "^10.19.0"
"preact": "10.18.1"
},
"devDependencies": {
"@babel/core": "^7.22.1",
Expand Down
Loading