Skip to content

Commit 9f39cf3

Browse files
committed
Fix component updater callback type
1 parent 51cfaee commit 9f39cf3

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

.changeset/crisp-sides-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@preact/signals": patch
3+
---
4+
5+
Avoid closing over VNodes in component updater callbacks.

packages/preact/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ hook(OptionsTypes.RENDER, (old, vnode) => {
238238
createComponentUpdateCallback(component),
239239
typeof vnode.type === "function"
240240
? vnode.type.displayName || vnode.type.name
241-
: "",
241+
: ""
242242
);
243243
}
244244
}
@@ -248,9 +248,9 @@ hook(OptionsTypes.RENDER, (old, vnode) => {
248248
}
249249
});
250250

251-
function createComponentUpdateCallback(component: Component) {
252-
return function(this: Effect) {
253-
if (DEVTOOLS_ENABLED) this!._debugCallback?.call(this);
251+
function createComponentUpdateCallback(component: AugmentedComponent) {
252+
return function (this: Effect) {
253+
if (DEVTOOLS_ENABLED) this._debugCallback?.call(this);
254254
component._updateFlags |= HAS_PENDING_UPDATE;
255255
component.setState({});
256256
};

0 commit comments

Comments
 (0)