Skip to content

Commit fe4d374

Browse files
ctrlplusbclaude
andauthored
chore(deps): upgrade immer 9 → 11 (#1035)
* chore(deps): upgrade immer 9 → 11 - Bump immer from ^9.0.21 to ^11.1.4 - Drop useProxies option in src/lib.js — immer v10 dropped ES5 mode and Proxy is now the only supported backend - Remove easy-peasy/proxy-polyfill subpath export — enableES5() no longer exists in immer - Document the subpath removal as a v7 breaking change in the upgrade guide - Keep easy-peasy/map-set-support — enableMapSet() is still opt-in in v11 Closes #1034 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(v7): rewrite browser-support page for immer v11 The proxy-polyfill subpath documented here was removed in #1035 — immer v10 dropped ES5 mode entirely, so the IE11 / non-Proxy environment workflow described on this page no longer applies. - Drop the "Polyfilling Proxy" and "Create React App IE11 Support" sections. - Reframe the page around React 19's supported runtimes (all ship native Proxy). - Keep the "Why Immer?" overview and the Map/Set support section. - Add a v6 → v7 migration callout pointing at the upgrade guide for consumers who imported the removed subpath. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 48a5f56 commit fe4d374

7 files changed

Lines changed: 53 additions & 87 deletions

File tree

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@
1919
"import": "./dist/server.js",
2020
"require": "./dist/server.cjs.js"
2121
},
22-
"./map-set-support": "./map-set-support.js",
23-
"./proxy-polyfill": "./proxy-polyfill.js"
22+
"./map-set-support": "./map-set-support.js"
2423
},
2524
"files": [
2625
"dist",
2726
"src",
2827
"index.d.ts",
2928
"server.d.ts",
30-
"proxy-polyfill.js",
31-
"proxy-polyfill.d.ts",
3229
"map-set-support.js",
3330
"map-set-support.d.ts"
3431
],
@@ -100,7 +97,7 @@
10097
},
10198
"dependencies": {
10299
"fast-deep-equal": "^3.1.3",
103-
"immer": "^9.0.21",
100+
"immer": "^11.1.4",
104101
"redux": "^5.0.1",
105102
"redux-thunk": "^3.1.0",
106103
"ts-toolbelt": "^9.6.0"

proxy-polyfill.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

proxy-polyfill.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/lib.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ export function createSimpleProduce(disableImmer = false) {
9696
}
9797
if (!easyPeasyImmer) {
9898
easyPeasyImmer = new Immer({
99-
// We need to ensure that we disable proxies if they aren't available
100-
// on the environment. Users need to ensure that they use the enableES5
101-
// feature of immer.
102-
useProxies:
103-
typeof Proxy !== 'undefined' &&
104-
typeof Proxy.revocable !== 'undefined' &&
105-
typeof Reflect !== 'undefined',
10699
// Autofreezing breaks easy-peasy, we need a mixed version of immutability
107100
// and mutability in order to apply updates to our computed properties
108101
autoFreeze: false,
Lines changed: 27 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
# Browsers & React Native
22

3-
Easy Peasy produces multiple bundle types - support for browsers, Common JS, and
4-
ESM.
5-
6-
However, due to our internal usage of [Immer](https://github.com/immerjs/immer)
7-
your code may break on some older browsers (e.g. IE 11) or some older React
8-
Native environments.
9-
10-
Specifically it will break on [environments](https://caniuse.com/?search=proxy)
11-
that don't support
12-
[proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy).
13-
14-
We provide a solution to this, however, before we present the solution we would
15-
like to describe our motivation for implementing Immer.
3+
Easy Peasy ships ESM and CommonJS bundles. The library targets the same
4+
environments that React 19 supports — modern evergreen browsers and current
5+
React Native runtimes.
166

177
- [Why Immer?](#why-immer)
18-
- [Polyfilling Proxy](#polyfilling-proxy)
19-
- [Create React App IE11 Support Example](#create-react-app-ie11-support-example)
8+
- [Proxy is required](#proxy-is-required)
209
- [Supporting Map or Set within your state](#supporting-map-or-set-within-your-state)
2110

2211
## Why Immer?
2312

24-
Immer powers our mutation based API that is supported within actions.
13+
Easy Peasy uses [Immer](https://github.com/immerjs/immer) to power the
14+
mutation-based API supported within actions:
2515

2616
```javascript
2717
addTodo: action((state, payload) => {
@@ -31,12 +21,10 @@ addTodo: action((state, payload) => {
3121
});
3222
```
3323

34-
[Immer](https://github.com/immerjs/immer) converts these mutation operations
35-
into immutable updates against the store.
36-
37-
This allows for a much improved developer experience as having to manage
38-
immutable update operations yourself can become quite complex. For example here
39-
is the same action above written to ensure immutability is met manually.
24+
Immer converts these mutation operations into immutable updates against the
25+
store. This is a much improved developer experience over managing immutable
26+
updates yourself, particularly for deeply nested state. The same action
27+
without Immer would look like:
4028

4129
```javascript
4230
addTodo: action((state, payload) => {
@@ -47,55 +35,29 @@ addTodo: action((state, payload) => {
4735
});
4836
```
4937

50-
That's just a simple example. More complex/nested updates can get very tricky to
51-
manage.
52-
53-
## Polyfilling Proxy
54-
55-
If you are getting errors on your console - typically error code 19 or 20 from
56-
the Immer package then your execution environment likely does not support
57-
[proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy).
58-
59-
To patch/polyfill your environment you need to include the following import.
60-
61-
```javascript
62-
import 'easy-peasy/proxy-polyfill';
63-
```
64-
65-
This should typically be done as early as possible within the entry file of your
66-
application.
67-
68-
### Create React App IE11 Support Example
38+
## Proxy is required
6939

70-
Create React App users will likely need to include a configuration like so,
71-
which includes full IE11 support;
40+
Immer relies on the
41+
[`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)
42+
global. Every browser in React 19's
43+
[supported list](https://react.dev/reference/react/version-history) ships
44+
native `Proxy`, as do all current React Native runtimes (Hermes, JSC), so no
45+
polyfill is required.
7246

73-
```javascript
74-
import 'react-app-polyfill/ie11';
75-
import 'react-app-polyfill/stable';
76-
import 'easy-peasy/proxy-polyfill';
77-
```
78-
79-
Also, don't forget to update your browserslist within your `package.json`.
80-
81-
```diff
82-
"browserslist": [
83-
+ "ie 11",
84-
">0.2%",
85-
"not dead",
86-
"not ie <= 10",
87-
"not op_mini all"
88-
]
89-
```
47+
> **Migrating from v6?** Easy Peasy v6 shipped an `easy-peasy/proxy-polyfill`
48+
> subpath that opted Immer into an ES5 fallback for environments without
49+
> native `Proxy` (notably IE11). v7 upgrades to Immer v11, which removed ES5
50+
> mode entirely, so the subpath has been deleted. Remove any
51+
> `import 'easy-peasy/proxy-polyfill';` lines — see the
52+
> [v6 → v7 upgrade guide](/docs/upgrading-from-v6/#easy-peasyproxy-polyfill-subpath-removed)
53+
> for details.
9054
9155
## Supporting Map or Set within your state
9256

93-
In order to utilize `Map` or `Set` within your state you need to include the
94-
following import.
57+
To use `Map` or `Set` within your state you need to opt into Immer's
58+
[Map/Set support](https://immerjs.github.io/immer/map-set/) by importing the
59+
following module as early as possible in your application's entry file:
9560

9661
```javascript
9762
import 'easy-peasy/map-set-support';
9863
```
99-
100-
Similarly to the Proxy polyfill you will need to do this as early as possible
101-
within your application entry file.

website/docs/docs/upgrading-from-v6/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This guide walks you through the breaking changes and the new APIs.
1212
- [Breaking changes](#breaking-changes)
1313
- [React 19 is required](#react-19-is-required)
1414
- [`useStoreRehydrated` now suspends](#usestorerehydrated-now-suspends)
15+
- [`easy-peasy/proxy-polyfill` subpath removed](#easy-peasyproxy-polyfill-subpath-removed)
1516
- [New APIs](#new-apis)
1617
- [`useStoreTransition`](#usestoretransition)
1718
- [`useStoreDeferredState`](#usestoredeferredstate)
@@ -113,6 +114,25 @@ If you previously wrote a wrapper component:
113114
> React deliver the rehydrated tree in a single render once the data is ready,
114115
> with no flash of default state.
115116
117+
### `easy-peasy/proxy-polyfill` subpath removed
118+
119+
v6 shipped an `easy-peasy/proxy-polyfill` subpath which called immer's
120+
`enableES5()` helper to support environments without native `Proxy` (notably
121+
IE11). Easy Peasy v7 upgrades to immer v11, which dropped ES5 mode entirely —
122+
`Proxy` is now the only supported backend.
123+
124+
If you imported the subpath:
125+
126+
```diff
127+
- import 'easy-peasy/proxy-polyfill';
128+
```
129+
130+
…remove the import. Every browser supported by React 19 has native `Proxy`, so
131+
no replacement is needed.
132+
133+
The `easy-peasy/map-set-support` subpath (which calls `enableMapSet()`) is
134+
unchanged — Map/Set draft support is still opt-in in immer v11.
135+
116136
## New APIs
117137

118138
### `useStoreTransition`

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,10 +2641,10 @@ ignore@^5.2.0:
26412641
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5"
26422642
integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==
26432643

2644-
immer@^9.0.21:
2645-
version "9.0.21"
2646-
resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.21.tgz#1e025ea31a40f24fb064f1fef23e931496330176"
2647-
integrity sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==
2644+
immer@^11.1.4:
2645+
version "11.1.4"
2646+
resolved "https://registry.yarnpkg.com/immer/-/immer-11.1.4.tgz#37aee86890b134a8f1a2fadd44361fb86c6ae67e"
2647+
integrity sha512-XREFCPo6ksxVzP4E0ekD5aMdf8WMwmdNaz6vuvxgI40UaEiu6q3p8X52aU6GdyvLY3XXX/8R7JOTXStz/nBbRw==
26482648

26492649
import-fresh@^3.2.1:
26502650
version "3.3.1"

0 commit comments

Comments
 (0)