Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix-3648
Browse files Browse the repository at this point in the history
  • Loading branch information
urugator committed Oct 29, 2023
2 parents d33d2c7 + 5063c38 commit 452832f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hip-bulldogs-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mobx-react": patch
---

Fixed premature disposal of class component observers.
2 changes: 1 addition & 1 deletion packages/mobx-react/src/observerClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function makeClassComponentObserver(
admin.mounted = true

// Component instance committed, prevent reaction disposal.
observerFinalizationRegistry.unregister(admin)
observerFinalizationRegistry.unregister(this)

// We don't set forceUpdate before mount because it requires a reference to `this`,
// therefore `this` could NOT be garbage collected before mount,
Expand Down

0 comments on commit 452832f

Please sign in to comment.