From aef2bade57e00026597a8a30042ea37b286c67ed Mon Sep 17 00:00:00 2001 From: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Date: Mon, 1 Jun 2020 10:26:55 +0800 Subject: [PATCH] fix: use immer will throw error in IE11 (#120) * fix: use immer will throw error * fix: fix lint * fix: fix by the comment * fix: fix lint error * chore: update version --- examples/counter/package.json | 7 +++++-- examples/counter/src/index.tsx | 8 +++++--- package.json | 4 ++-- src/plugins/immer.ts | 7 +++++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/examples/counter/package.json b/examples/counter/package.json index 86e10a82..d7254fad 100644 --- a/examples/counter/package.json +++ b/examples/counter/package.json @@ -5,6 +5,7 @@ "dependencies": { "@ice/store": "^1.3.4", "react": "^16.8.6", + "react-app-polyfill": "^1.0.6", "react-dom": "^16.8.6" }, "devDependencies": { @@ -23,12 +24,14 @@ "production": [ ">0.2%", "not dead", - "not op_mini all" + "not op_mini all", + "ie 11" ], "development": [ "last 1 chrome version", "last 1 firefox version", - "last 1 safari version" + "last 1 safari version", + "ie 11" ] } } \ No newline at end of file diff --git a/examples/counter/src/index.tsx b/examples/counter/src/index.tsx index de0a0689..9d612d47 100644 --- a/examples/counter/src/index.tsx +++ b/examples/counter/src/index.tsx @@ -1,6 +1,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { createStore } from '@ice/store'; +import 'react-app-polyfill/ie11'; +import 'react-app-polyfill/stable'; const delay = (time) => new Promise((resolve) => setTimeout(() => resolve(), time)); @@ -8,8 +10,8 @@ const delay = (time) => new Promise((resolve) => setTimeout(() => resolve(), tim const counter = { state: 0, reducers: { - increment:(prevState) => prevState + 1, - decrement:(prevState) => prevState - 1, + increment: (prevState) => prevState + 1, + decrement: (prevState) => prevState - 1, }, effects: () => ({ async asyncDecrement() { @@ -29,7 +31,7 @@ const store = createStore(models); // 3️⃣ Consume model const { useModel } = store; function Counter() { - const [ count, dispatchers ] = useModel('counter'); + const [count, dispatchers] = useModel('counter'); const { increment, asyncDecrement } = dispatchers; return (