From 83732c015c89948bf80686585c9b42915adb4632 Mon Sep 17 00:00:00 2001 From: apartx <60512874+apartx@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:51:54 +0500 Subject: [PATCH 1/4] Update CacheSwitch.js Remove deprecated defaultProps construct for CacheSwitch component. Instead move it to render function in spread default values. --- src/components/CacheSwitch.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/CacheSwitch.js b/src/components/CacheSwitch.js index 58bd605..7c70fec 100644 --- a/src/components/CacheSwitch.js +++ b/src/components/CacheSwitch.js @@ -33,7 +33,11 @@ class CacheSwitch extends Switch { } render() { - const { children, which, autoFreeze } = this.props + const { + children, + which = element => get(element, 'type.__name') === 'CacheRoute', + autoFreeze + } = this.props const { location, match: contextMatch } = this.getContext() let __matchedAlready = false @@ -131,8 +135,4 @@ if (isUsingNewContext) { } } -CacheSwitch.defaultProps = { - which: element => get(element, 'type.__name') === 'CacheRoute' -} - export default CacheSwitch From 3c053ab168cca0da76f3d1dd91d4a2db3fc1382c Mon Sep 17 00:00:00 2001 From: apartx <60512874+apartx@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:44:18 +0500 Subject: [PATCH 2/4] Update index.js --- index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 8b4c81d..97e7567 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ 'use strict'; -if (process.env.NODE_ENV === 'production') { - module.exports = require('./lib/index.min.js'); -} else { - module.exports = require('./lib/index.js'); -} \ No newline at end of file +// if (process.env.NODE_ENV === 'production') { +// module.exports = require('./lib/index.min.js'); +// } else { +// module.exports = require('./lib/index.js'); +// } +module.exports = require('./src/index.js'); From 282b80215663d3fa6b8cb5d189ff46f81c81bdd6 Mon Sep 17 00:00:00 2001 From: apartx <60512874+apartx@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:46:00 +0500 Subject: [PATCH 3/4] Update .npmignore --- .npmignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.npmignore b/.npmignore index 89017a6..db73954 100644 --- a/.npmignore +++ b/.npmignore @@ -1,9 +1,9 @@ docs node_modules -src +# src .babelrc .gitignore .npmignore .prettierrc rollup.config.js -yarn.lock \ No newline at end of file +yarn.lock From fbbbae88de76d543d6e49497c4cc6a960d0d64b3 Mon Sep 17 00:00:00 2001 From: apartx <60512874+apartx@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:11:25 +0500 Subject: [PATCH 4/4] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7465cc..a07573d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-router-cache-route", "version": "1.13.0", "description": "cache-route for react-router base on react v15+ and router v4+", - "main": "index.js", + "main": "src/index.js", "scripts": { "build": "rollup --config" },