Skip to content

Commit 1101d1f

Browse files
patch: deep access error (#514)
* patch: deep access error * Create early-parents-raise.md --------- Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
1 parent a6c9be9 commit 1101d1f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/early-parents-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@prefresh/core": patch
3+
---
4+
5+
add guard for undefined component before accessing parentDom

packages/core/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function replaceComponent(OldType, NewType, resetHookState) {
5454
pendingUpdates = pendingUpdates.filter(p => p[0] !== OldType);
5555

5656
vnodes.forEach(vnode => {
57-
if (!vnode.__c.__P) return;
57+
if (!vnode.__c || !vnode.__c.__P) return;
5858
// update the type in-place to reference the new component
5959
vnode.type = NewType;
6060

0 commit comments

Comments
 (0)