From 2332d7091a14037f25c4d67a8301169e90b50bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Fri, 30 Dec 2022 03:57:39 +0800 Subject: [PATCH] fix(command): re-register when component activated --- composables/command.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composables/command.ts b/composables/command.ts index bfa29b0b..20a3306e 100644 --- a/composables/command.ts +++ b/composables/command.ts @@ -208,10 +208,11 @@ export const useCommandRegistry = defineStore('command', () => { export const useCommand = (cmd: CommandProvider) => { const registry = useCommandRegistry() - registry.register(cmd) - + const register = () => registry.register(cmd) const cleanup = () => registry.remove(cmd) + register() + onActivated(register) onDeactivated(cleanup) tryOnScopeDispose(cleanup) }