From 339ef19b3bd6047f22f8c3b4d080c3e546b9dabe Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Tue, 13 Aug 2024 11:03:33 +0200 Subject: [PATCH] Updated immer and removed polyfills --- package-lock.json | 80 ++----------------- package.json | 3 +- .../shared/Form/ShowHide/ShowHide.tsx | 2 +- .../hooks/useFlashMessagesReducer.ts | 2 +- src/app/state/rest/hooks/useApiCache.ts | 2 +- src/app/state/rest/hooks/useRequestQueue.tsx | 2 +- src/index.tsx | 2 - src/polyfills/index.ts | 6 -- 8 files changed, 13 insertions(+), 86 deletions(-) delete mode 100644 src/polyfills/index.ts diff --git a/package-lock.json b/package-lock.json index df209cc19..782e1f73d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@types/lodash.debounce": "^4.0.7", "@types/lodash.isempty": "^4.4.7", "@types/lodash.merge": "^4.6.7", + "@types/node": "^20.14.2", "@types/qs": "^6.9.7", "@types/react": "^17.0.43", "@types/react-dom": "^18.0.3", @@ -33,7 +34,7 @@ "eslint-config-react-app": "^7.0.1", "final-form": "^4.20.10", "final-form-arrays": "^3.0.2", - "immer": "^9.0.16", + "immer": "^10.1.1", "keycloak-js": "^24.0.1", "lodash.debounce": "^4.0.8", "lodash.isempty": "^4.4.0", @@ -41,7 +42,6 @@ "moment": "^2.29.4", "qs": "^6.11.2", "react": "^17.0.2", - "react-app-polyfill": "^3.0.0", "react-dom": "^17.0.2", "react-final-form": "^6.5.9", "react-final-form-arrays": "^3.1.4", @@ -125,15 +125,6 @@ "styled-components": ">= 5" } }, - "node_modules/@amsterdam/amsterdam-react-final-form/node_modules/immer": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.3.tgz", - "integrity": "sha512-pwupu3eWfouuaowscykeckFmVTpqbzW+rXFCX8rQLkZzM9ftBmU/++Ra+o+L27mz03zJTlyV4UUr+fdKNffo4A==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/immer" - } - }, "node_modules/@amsterdam/asc-assets": { "version": "0.38.0", "resolved": "https://registry.npmjs.org/@amsterdam/asc-assets/-/asc-assets-0.38.0.tgz", @@ -5415,11 +5406,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" - }, "node_modules/asn1": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", @@ -6286,16 +6272,6 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, - "node_modules/core-js": { - "version": "3.36.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.36.0.tgz", - "integrity": "sha512-mt7+TUBbTFg5+GngsAxeKBTl5/VS0guFeJacYge9OmHb+m058UwwIm41SE9T4Den7ClatV57B6TYTuJ0CX1MAw==", - "hasInstallScript": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, "node_modules/core-js-compat": { "version": "3.36.0", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.36.0.tgz", @@ -8780,9 +8756,10 @@ } }, "node_modules/immer": { - "version": "9.0.21", - "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz", - "integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "license": "MIT", "funding": { "type": "opencollective", "url": "https://opencollective.com/immer" @@ -12685,7 +12662,8 @@ "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "dev": true }, "node_modules/picocolors": { "version": "1.0.1", @@ -12842,14 +12820,6 @@ "node": ">= 0.6.0" } }, - "node_modules/promise": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz", - "integrity": "sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg==", - "dependencies": { - "asap": "~2.0.6" - } - }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -12971,14 +12941,6 @@ } ] }, - "node_modules/raf": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", - "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", - "dependencies": { - "performance-now": "^2.1.0" - } - }, "node_modules/react": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", @@ -12991,27 +12953,6 @@ "node": ">=0.10.0" } }, - "node_modules/react-app-polyfill": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-3.0.0.tgz", - "integrity": "sha512-sZ41cxiU5llIB003yxxQBYrARBqe0repqPTTYBTmMqTz9szeBbE37BehCE891NZsmdZqqP+xWKdT3eo3vOzN8w==", - "dependencies": { - "core-js": "^3.19.2", - "object-assign": "^4.1.1", - "promise": "^8.1.0", - "raf": "^3.4.1", - "regenerator-runtime": "^0.13.9", - "whatwg-fetch": "^3.6.2" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/react-app-polyfill/node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" - }, "node_modules/react-dom": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", @@ -14732,11 +14673,6 @@ "node": ">=12" } }, - "node_modules/whatwg-fetch": { - "version": "3.6.20", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", - "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" - }, "node_modules/whatwg-mimetype": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", diff --git a/package.json b/package.json index e8dc34862..8ec5da6ed 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "eslint-config-react-app": "^7.0.1", "final-form": "^4.20.10", "final-form-arrays": "^3.0.2", - "immer": "^9.0.16", + "immer": "^10.1.1", "keycloak-js": "^24.0.1", "lodash.debounce": "^4.0.8", "lodash.isempty": "^4.4.0", @@ -59,7 +59,6 @@ "moment": "^2.29.4", "qs": "^6.11.2", "react": "^17.0.2", - "react-app-polyfill": "^3.0.0", "react-dom": "^17.0.2", "react-final-form": "^6.5.9", "react-final-form-arrays": "^3.1.4", diff --git a/src/app/components/shared/Form/ShowHide/ShowHide.tsx b/src/app/components/shared/Form/ShowHide/ShowHide.tsx index 7c65d47ff..989048414 100644 --- a/src/app/components/shared/Form/ShowHide/ShowHide.tsx +++ b/src/app/components/shared/Form/ShowHide/ShowHide.tsx @@ -1,6 +1,6 @@ import { useEffect } from "react" -import produce from "immer" +import { produce } from "immer" import { useFormState, useForm } from "react-final-form" import { FormState } from "final-form" import { Dimensions, Responsive } from "@amsterdam/amsterdam-react-final-form" diff --git a/src/app/state/flashMessages/hooks/useFlashMessagesReducer.ts b/src/app/state/flashMessages/hooks/useFlashMessagesReducer.ts index 26648d5bb..1c42b13c9 100644 --- a/src/app/state/flashMessages/hooks/useFlashMessagesReducer.ts +++ b/src/app/state/flashMessages/hooks/useFlashMessagesReducer.ts @@ -1,6 +1,6 @@ import { ComponentProps, ReactNode, useCallback, useEffect, useReducer } from "react" import { useLocation } from "react-router-dom" -import produce from "immer" +import { produce } from "immer" import { Alert } from "@amsterdam/asc-ui" export type FlashMessage = ComponentProps diff --git a/src/app/state/rest/hooks/useApiCache.ts b/src/app/state/rest/hooks/useApiCache.ts index e2ffa63ba..c2034d8c6 100644 --- a/src/app/state/rest/hooks/useApiCache.ts +++ b/src/app/state/rest/hooks/useApiCache.ts @@ -1,5 +1,5 @@ import { useCallback, useReducer } from "react" -import produce from "immer" +import { produce } from "immer" export type ApiCacheItem = { valid: boolean diff --git a/src/app/state/rest/hooks/useRequestQueue.tsx b/src/app/state/rest/hooks/useRequestQueue.tsx index faa9dfbb4..3a00cfa5d 100644 --- a/src/app/state/rest/hooks/useRequestQueue.tsx +++ b/src/app/state/rest/hooks/useRequestQueue.tsx @@ -1,5 +1,5 @@ import { useReducer, useCallback, useEffect, useState } from "react" -import produce from "immer" +import { produce } from "immer" type QueuedPromise = () => Promise diff --git a/src/index.tsx b/src/index.tsx index 9e353d0dc..66cb78881 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,3 @@ -import "./polyfills/" - import { StrictMode } from "react" import ReactDOM from "react-dom" import App from "./App" diff --git a/src/polyfills/index.ts b/src/polyfills/index.ts deleted file mode 100644 index f9ebe5bb8..000000000 --- a/src/polyfills/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import "react-app-polyfill/ie11" -import "react-app-polyfill/stable" -import { enableES5, enableAllPlugins } from "immer" - -enableES5() -enableAllPlugins()