Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fair-houses-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mobx": patch
---

Fixed memory leak where makeAutoObservable would keep wrapping setters defined on the prototype. Fixes #4553
7 changes: 5 additions & 2 deletions packages/mobx/src/types/autoannotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
autoAction,
isGenerator,
MakeResult,
die
die,
isAction
} from "../internal"

const AUTO = "true"
Expand Down Expand Up @@ -40,7 +41,9 @@ function make_(
// lone setter -> action setter
if (descriptor.set) {
// TODO make action applicable to setter and delegate to action.make_
const set = createAction(key.toString(), descriptor.set) as (v: any) => void
const set = isAction(descriptor.set)
? descriptor.set // See #4553
: (createAction(key.toString(), descriptor.set) as (v: any) => void)
// own
if (source === adm.target_) {
return adm.defineProperty_(key, {
Expand Down