From d7944da48f49cd285974d7f833f9a5aa3d39f21d Mon Sep 17 00:00:00 2001 From: xiaohuoni Date: Thu, 16 Jun 2022 16:08:27 +0800 Subject: [PATCH] chore: add changeset --- .changeset/chilled-islands-sort.md | 5 +++++ packages/plugins/templates/keepalive/context.tpl | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .changeset/chilled-islands-sort.md diff --git a/.changeset/chilled-islands-sort.md b/.changeset/chilled-islands-sort.md new file mode 100644 index 00000000..4eb6dcd9 --- /dev/null +++ b/.changeset/chilled-islands-sort.md @@ -0,0 +1,5 @@ +--- +'@alita/plugins': patch +--- + +fix: dropByCacheKey current page no closes diff --git a/packages/plugins/templates/keepalive/context.tpl b/packages/plugins/templates/keepalive/context.tpl index c2b83042..9e32032f 100644 --- a/packages/plugins/templates/keepalive/context.tpl +++ b/packages/plugins/templates/keepalive/context.tpl @@ -31,8 +31,8 @@ export function useKeepOutlets() { const element = useOutlet(); {{#hasTabsLayout}} const navigate = useNavigate(); - const runtime = getPluginManager().applyPlugins({ key: 'tabsLayout',type: 'modify', initialValue: {} }); -const {local} = runtime; + const runtime = getPluginManager().applyPlugins({ key: 'tabsLayout',type: 'modify', initialValue: {} }); + const { local } = runtime; {{/hasTabsLayout}} const { cacheKeyMap, keepElements, keepalive, dropByCacheKey } = React.useContext(KeepAliveContext); const isKeep = isKeepPath(keepalive, location.pathname); @@ -52,7 +52,6 @@ const {local} = runtime; if (newPanel[i] === targetKey) { lastIndex = i - 1; } - } const newPanes = newPanel.filter(pane => pane !== targetKey); if (newPanes.length && newActiveKey === targetKey) {