Skip to content

Commit 7ce4bce

Browse files
committed
fix(use-app-global): always return computed
1 parent 5ea9888 commit 7ce4bce

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

packages/ui/src/composables/useAppGlobal.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ const getGlobalObject = () => {
2424
export const useAppGlobal = <T>(key: string, defaultValue: T): WritableComputedRef<T> => {
2525
const globalObject = getGlobalObject()
2626

27-
if (key in globalObject) {
28-
return globalObject[key]
27+
if (!(key in globalObject)) {
28+
globalObject[key] = defaultValue
2929
}
3030

31-
globalObject[key] = defaultValue
32-
3331
return computed({
3432
get: () => globalObject[key],
3533
set: (value: T) => {

0 commit comments

Comments
 (0)