diff --git a/dist/cacheRoute.js b/dist/cacheRoute.js index 64f78e6..cf35a75 100644 --- a/dist/cacheRoute.js +++ b/dist/cacheRoute.js @@ -283,9 +283,9 @@ function isScrollableNode() { var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - // if (!isExist(node)) { - // return false - // } + if (!isExist(node)) { + return false; + } return node.scrollWidth > node.clientWidth || node.scrollHeight > node.clientHeight; } @@ -352,7 +352,7 @@ }; var dropByCacheKey = function dropByCacheKey(key) { - var cache = get(__components, key); + var cache = get(__components, [key]); if (!cache) { return; diff --git a/dist/cacheRoute.min.js b/dist/cacheRoute.min.js index d50a4c2..977fd76 100644 --- a/dist/cacheRoute.min.js +++ b/dist/cacheRoute.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","react-router-dom"],t):t(e.CacheRoute={},e.React,e.PropTypes,e.reactRouterDom)}(this,function(e,w,t,u){"use strict";var g="default"in w?w.default:w;t=t&&t.hasOwnProperty("default")?t.default:t;var o=function(e){return void 0===e},l=function(e){return null===e},i=function(e){return"function"==typeof e},h=function(e){return"string"==typeof e},n=function(e){return!(o(e)||l(e))},r=function(e){return e instanceof Array},O=function(e){return"number"==typeof e&&!((t=e)!=t);var t},s=function(e){var t=1e.clientWidth||e.scrollHeight>e.clientHeight}function N(e){return i(s(_,"document.getElementById"))?[].concat(a(m(j(e,"querySelectorAll","*"),[])),[e]).filter(T):[]}function A(e){var t=[].concat(a(new Set([].concat(a(function n(e){return e.reduce(function(e,t){return[].concat(a(e),a(r(t)?n(t):[t]))},[])}((r(e)?e:[e]).map(N))),a([S,R].filter(T)))))).map(function(e){return[e,{x:e.scrollLeft,y:e.scrollTop}]});return function(){t.forEach(function(e){var t=E(e,2),n=t[0],r=t[1],o=r.x,c=r.y;n.scrollLeft=o,n.scrollTop=c})}}var K={},M=function(){return Object.entries(K).filter(function(e){var t=E(e,2)[1];return t instanceof H?t.state.cached:Object.values(t).some(function(e){return e.state.cached})})},k=function(){return C({},K)},x=function(e,t){K[e]=t},q=function(e){delete K[e]},D=function(e){return j(e,"reset")},F=function(e){var t=s(K,e);t&&(t instanceof H?D(t):Object.values(t).forEach(D))},L=n(g.forwardRef),U="__isComputedUnmatch",B=function(e){return n(e)&&!0!==s(e,U)},W=function(e,t){var n=e.match,r=e.when,o=void 0===r?"forward":r;if(B(n)||(n=null),!t.cached&&n)return{cached:!0,matched:!0};if(t.matched&&!n){var c=s(e,"history.action"),a=!1;if(i(o))a=!o(e);else switch(o){case"always":break;case"back":["PUSH","REPLACE"].includes(c)&&(a=!0);break;case"forward":default:"POP"===c&&(a=!0)}if(a)return{cached:!1,matched:!1}}return{matched:!!n}},H=function(e){function l(e){var t;f(this,l);for(var n=arguments.length,r=Array(1e.clientWidth||e.scrollHeight>e.clientHeight)}function N(e){return i(s(_,"document.getElementById"))?[].concat(a(m(j(e,"querySelectorAll","*"),[])),[e]).filter(T):[]}function A(e){var t=[].concat(a(new Set([].concat(a(function n(e){return e.reduce(function(e,t){return[].concat(a(e),a(r(t)?n(t):[t]))},[])}((r(e)?e:[e]).map(N))),a([S,R].filter(T)))))).map(function(e){return[e,{x:e.scrollLeft,y:e.scrollTop}]});return function(){t.forEach(function(e){var t=E(e,2),n=t[0],r=t[1],o=r.x,c=r.y;n.scrollLeft=o,n.scrollTop=c})}}var K={},M=function(){return Object.entries(K).filter(function(e){var t=E(e,2)[1];return t instanceof H?t.state.cached:Object.values(t).some(function(e){return e.state.cached})})},k=function(){return C({},K)},x=function(e,t){K[e]=t},q=function(e){delete K[e]},D=function(e){return j(e,"reset")},F=function(e){var t=s(K,[e]);t&&(t instanceof H?D(t):Object.values(t).forEach(D))},L=n(g.forwardRef),U="__isComputedUnmatch",B=function(e){return n(e)&&!0!==s(e,U)},W=function(e,t){var n=e.match,r=e.when,o=void 0===r?"forward":r;if(B(n)||(n=null),!t.cached&&n)return{cached:!0,matched:!0};if(t.matched&&!n){var c=s(e,"history.action"),a=!1;if(i(o))a=!o(e);else switch(o){case"always":break;case"back":["PUSH","REPLACE"].includes(c)&&(a=!0);break;case"forward":default:"POP"===c&&(a=!0)}if(a)return{cached:!1,matched:!1}}return{matched:!!n}},H=function(e){function l(e){var t;f(this,l);for(var n=arguments.length,r=Array(1 { const dropComponent = component => run(component, 'reset') export const dropByCacheKey = key => { - const cache = get(__components, key) + const cache = get(__components, [key]) if (!cache) { return diff --git a/src/helpers/saveScrollPosition.js b/src/helpers/saveScrollPosition.js index aa5d557..7d039af 100644 --- a/src/helpers/saveScrollPosition.js +++ b/src/helpers/saveScrollPosition.js @@ -11,9 +11,9 @@ const screenScrollingElement = get( ) function isScrollableNode(node = {}) { - // if (!isExist(node)) { - // return false - // } + if (!isExist(node)) { + return false + } return ( node.scrollWidth > node.clientWidth || node.scrollHeight > node.clientHeight