Skip to content

Commit

Permalink
fix(use-app-global): always return computed
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem committed Mar 11, 2024
1 parent 5ea9888 commit 7ce4bce
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/ui/src/composables/useAppGlobal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ const getGlobalObject = () => {
export const useAppGlobal = <T>(key: string, defaultValue: T): WritableComputedRef<T> => {
const globalObject = getGlobalObject()

if (key in globalObject) {
return globalObject[key]
if (!(key in globalObject)) {
globalObject[key] = defaultValue
}

globalObject[key] = defaultValue

return computed({
get: () => globalObject[key],
set: (value: T) => {
Expand Down

0 comments on commit 7ce4bce

Please sign in to comment.