-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
annotations + subclassing rework (#2641)
* wip * fix unused vars * fix comment * revert enumerability changes * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * comments * processing comments * processing comments * descriptor cache * ... * don't annotate proto on action.bound * optimize makeAutoObservable, fix symbolic action name, fix inferred annotation caching * cleanup, defineProperty tests * fix comment * fix comment * extendObservable includes non-enumerable, optimize makeAutoObservable * little tweak * fix imports, fix plain object detection * docs * docs * changeset
- Loading branch information
Showing
47 changed files
with
2,765 additions
and
1,434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"mobx": minor | ||
"mobx-react-lite": minor | ||
--- | ||
|
||
`action`, `computed`, `flow` defined on prototype can be overriden by subclass via `override` annotation/decorator. Previously broken. | ||
Overriding anything defined on instance itself (`this`) is not supported and should throw. Previously partially possible or broken. | ||
Attempt to re-annotate property always throws. Previously mostly undefined outcome. | ||
All annotated and non-observable props (action/flow) are non-writable. Previously writable. | ||
All annotated props of non-plain object are non-configurable. Previously configurable. | ||
Observable object should now work more reliably in various (edge) cases. | ||
Proxied objects now support `Object.defineProperty`. Previously unsupported/broken. | ||
`extendObservable/makeObservable/defineProperty` notifies observers/listeners/interceptors about added props. Peviously inconsistent. | ||
`keys/values/entries` works like `Object.keys/values/entries`. Previously included only observables. | ||
`has` works like `in`. Previously reported `true` only for existing own observable props. | ||
`set` no longer transforms existing non-observable prop to observable prop, but simply sets the value. | ||
`remove/delete` works with non-observable and computed props. Previously unsupported/broken. | ||
Passing `options` to `observable/extendObservable/makeObservable` throws if the object is already observable . Previously passed options were mostly ignored. | ||
`autoBind` option is now sticky - same as `deep` and `name` option. | ||
`observable/extendObservable` now also picks non-enumerable keys (same as `make[Auto]Observable`). | ||
Removed deprecated `action.bound("name")` | ||
Proxied objects should be compatible with `Reflect` API. Previously throwing instead of returning booleans. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,6 @@ Object { | |
Object { | ||
"name": "[email protected]", | ||
}, | ||
Object { | ||
"name": "[email protected]?", | ||
}, | ||
Object { | ||
"dependencies": Array [ | ||
Object { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.