mobx-react 7.6.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # mobx-react
2
2
 
3
+ ## 8.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`44a2cf42`](https://github.com/mobxjs/mobx/commit/44a2cf42dec7635f639ddbfb19202ebc710bac54) [#3590](https://github.com/mobxjs/mobx/pull/3590) Thanks [@urugator](https://github.com/urugator)! - Functional components now use `useSyncExternalStore`, which should prevent tearing - you have to update mobx, otherwise it should behave as previously.<br>
8
+ Improved displayName/name handling of functional components as discussed in #3438.<br>
9
+ Reactions of uncommited class components are now correctly disposed, fixes #3492.<br>
10
+ Reactions don't notify uncommited class components, avoiding the warning, fixes #3492.<br>
11
+ Removed symbol "polyfill" and replaced with actual Symbols.<br>
12
+ Removed `this.render` replacement detection + warning. `this.render` is no longer configurable/writable (possibly BC).<br>
13
+ Class component instance is no longer exposed as `component[$mobx]["reactcomponent"]` (possibly BC).<br>
14
+ Deprecated `disposeOnUnmount`, it's not compatible with remounting.<br>
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`44a2cf42`](https://github.com/mobxjs/mobx/commit/44a2cf42dec7635f639ddbfb19202ebc710bac54)]:
19
+ - mobx-react-lite@4.0.0
20
+
3
21
  ## 7.6.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -11,15 +11,15 @@ Exports the `observer` decorator and other utilities.
11
11
  For documentation, see the [MobX](https://mobx.js.org) project.
12
12
  This package supports both React and React Native.
13
13
 
14
- ## Choosing your version
14
+ ## Compatibility matrix
15
15
 
16
- There are currently two actively maintained versions of mobx-react:
16
+ Only the latest version is actively maintained. If you're missing a fix or a feature in older version, consider upgrading or using [patch-package](https://www.npmjs.com/package/patch-package)
17
17
 
18
18
  | NPM Version | Support MobX version | Supported React versions | Supports hook based components |
19
19
  | ----------- | -------------------- | ------------------------ | -------------------------------------------------------------------------------- |
20
- | v7 | 6.\* | 16.8+ | Yes |
21
- | v6 | 4._ / 5._ | 16.8+ | Yes |
22
- | v5 | 4._ / 5._ | 0.13+ | No, but it is possible to use `<Observer>` sections inside hook based components |
20
+ | v7 | 6.\* | >16.8 | Yes |
21
+ | v6 | 4.\* / 5.\* | >16.8 <18 | Yes |
22
+ | v5 | 4.\* / 5.\* | >0.13 <18 | No, but it is possible to use `<Observer>` sections inside hook based components |
23
23
 
24
24
  mobx-react 6 / 7 is a repackage of the smaller [mobx-react-lite](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react-lite) package + following features from the `mobx-react@5` package added:
25
25
 
@@ -136,8 +136,6 @@ person.name = "Mike" // will cause the Observer region to re-render
136
136
 
137
137
  ### `useLocalObservable` hook
138
138
 
139
- [User guide](https://mobx-react.js.org/state-local)
140
-
141
139
  Local observable state can be introduced by using the `useLocalObservable` hook, that runs once to create an observable store. A quick example would be:
142
140
 
143
141
  ```javascript
@@ -218,8 +216,6 @@ Use `import { PropTypes } from "mobx-react"` to import them, then use for exampl
218
216
 
219
217
  ### `Provider` and `inject`
220
218
 
221
- See also [the migration guide to React Hooks](https://mobx-react.js.org/recipes-migration).
222
-
223
219
  _Note: usually there is no need anymore to use `Provider` / `inject` in new code bases; most of its features are now covered by `React.createContext`._
224
220
 
225
221
  `Provider` is a component that can pass stores (or other stuff) using React's context mechanism to child components.
@@ -270,7 +266,7 @@ Notes:
270
266
  #### "The set of provided stores has changed" error
271
267
 
272
268
  Values provided through `Provider` should be final. Make sure that if you put things in `context` that might change over time, that they are `@observable` or provide some other means to listen to changes, like callbacks. However, if your stores will change over time, like an observable value of another store, MobX will throw an error.
273
- This restriction exists mainly for legacy reasons. If you have a scenario where you need to modify the set of stores, please leave a comment about it in this issue https://github.com/mobxjs/mobx-react/issues/745. Or a preferred way is to [use React Context](https://mobx-react.js.org/recipes-context) directly which does not have this restriction.
269
+ This restriction exists mainly for legacy reasons. If you have a scenario where you need to modify the set of stores, please leave a comment about it in this issue https://github.com/mobxjs/mobx-react/issues/745. Or a preferred way is to [use React Context](https://reactjs.org/docs/context.html) directly which does not have this restriction.
274
270
 
275
271
  #### Inject as function
276
272
 
@@ -398,8 +394,6 @@ public render() {
398
394
  }
399
395
  ```
400
396
 
401
- By [migrating to React Hooks](https://mobx-react.js.org/recipes-migration) you can avoid problems with TypeScript.
402
-
403
397
  #### Testing store injection
404
398
 
405
399
  It is allowed to pass any declared store in directly as a property as well. This makes it easy to set up individual component tests without a provider.
@@ -1,5 +1,11 @@
1
1
  import React from "react";
2
2
  declare type Disposer = () => void;
3
+ /**
4
+ * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.
5
+ */
3
6
  export declare function disposeOnUnmount(target: React.Component<any, any>, propertyKey: PropertyKey): void;
7
+ /**
8
+ * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.
9
+ */
4
10
  export declare function disposeOnUnmount<TF extends Disposer | Array<Disposer>>(target: React.Component<any, any>, fn: TF): TF;
5
11
  export {};