fix(command): re-register when component activated
parent
f1f2449559
commit
2332d7091a
|
@ -208,10 +208,11 @@ export const useCommandRegistry = defineStore('command', () => {
|
||||||
export const useCommand = (cmd: CommandProvider) => {
|
export const useCommand = (cmd: CommandProvider) => {
|
||||||
const registry = useCommandRegistry()
|
const registry = useCommandRegistry()
|
||||||
|
|
||||||
registry.register(cmd)
|
const register = () => registry.register(cmd)
|
||||||
|
|
||||||
const cleanup = () => registry.remove(cmd)
|
const cleanup = () => registry.remove(cmd)
|
||||||
|
|
||||||
|
register()
|
||||||
|
onActivated(register)
|
||||||
onDeactivated(cleanup)
|
onDeactivated(cleanup)
|
||||||
tryOnScopeDispose(cleanup)
|
tryOnScopeDispose(cleanup)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue