Commit 0d1313ac authored by Shen Chang's avatar Shen Chang

fix(Fix include and exclude):

parent 656db95d
...@@ -17,10 +17,10 @@ export default function getKeepAlive( ...@@ -17,10 +17,10 @@ export default function getKeepAlive(
name: string, name: string,
include?: Pattern, include?: Pattern,
exclude?: Pattern, exclude?: Pattern,
keepAlive?: boolean disabled?: boolean
) { ) {
if (keepAlive !== undefined) { if (disabled !== undefined) {
return keepAlive; return !disabled;
} }
if ( if (
(include && (!name || !matches(include, name))) || (include && (!name || !matches(include, name))) ||
......
...@@ -437,7 +437,7 @@ export default function keepAliveDecorator<P = any>(Component: React.ComponentTy ...@@ -437,7 +437,7 @@ export default function keepAliveDecorator<P = any>(Component: React.ComponentTy
warn('[React Keep Alive] <KeepAlive> components must have key.'); warn('[React Keep Alive] <KeepAlive> components must have key.');
return null; return null;
} }
const newKeepAlive = getKeepAlive(propKey, include, exclude, !disabled); const newKeepAlive = getKeepAlive(propKey, include, exclude, disabled);
this.combinedKeepAlive = getLifecycle === undefined || getLifecycle() === LIFECYCLE.UPDATING this.combinedKeepAlive = getLifecycle === undefined || getLifecycle() === LIFECYCLE.UPDATING
? newKeepAlive ? newKeepAlive
: identification : identification
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment