Skip to content

Commit af1bd0f

Browse files
authored
Merge branch 'main' into support-alternate-content-doc
2 parents be691db + 2712cb5 commit af1bd0f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compat/src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ declare namespace preact {
2727
getDerivedStateFromError?(error: any): Partial<S> | null;
2828
}
2929

30-
// eslint-disablex-next-line @typescript-eslint/no-unsafe-declaration-merging
30+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
3131
export interface Component<P = {}, S = {}> {
3232
componentWillMount?(): void;
3333
componentDidMount?(): void;

debug/src/component-stack.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ let renderStack = [];
4040
* ```
4141
*
4242
* Note: A `vnode` may be hoisted to the root scope due to compiler
43-
* optimiztions. In these cases the `_owner` will be different.
43+
* optimiztions. In these cases the owner will be different.
4444
*/
4545
let ownerStack = [];
4646

47+
const ownerMap = new WeakMap();
48+
4749
/**
4850
* Get the currently rendered `vnode`
4951
* @returns {import('./internal').VNode | null}
@@ -76,9 +78,8 @@ function isPossibleOwner(vnode) {
7678
export function getOwnerStack(vnode) {
7779
const stack = [vnode];
7880
let next = vnode;
79-
while (next._owner != null) {
80-
stack.push(next._owner);
81-
next = next._owner;
81+
while ((next = ownerMap.get(next)) != null) {
82+
stack.push(next);
8283
}
8384

8485
return stack.reduce((acc, owner) => {
@@ -131,8 +132,7 @@ export function setupComponentStack() {
131132
};
132133

133134
options.vnode = vnode => {
134-
vnode._owner =
135-
ownerStack.length > 0 ? ownerStack[ownerStack.length - 1] : null;
135+
ownerMap.set(vnode, ownerStack.length > 0 ? ownerStack[ownerStack.length - 1] : null);
136136
if (oldVNode) oldVNode(vnode);
137137
};
138138

0 commit comments

Comments
 (0)