Skip to content

Commit

Permalink
fix(config): replace new value if config is an array (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored Oct 24, 2023
1 parent d6090df commit 869f61e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/runtime/composables/useStudio.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp, nextTick } from 'vue'
import { createApp } from 'vue'
import type { Storage } from 'unstorage'
import type { ParsedContent } from '@nuxt/content/dist/runtime/types'
import { defu } from 'defu'
import { createDefu } from 'defu'
import type { RouteLocationNormalized } from 'vue-router'
import ContentPreviewMode from '../components/ContentPreviewMode.vue'
import { createSingleton, deepAssign, deepDelete, mergeDraft, StudioConfigFiles } from '../utils'
Expand All @@ -11,6 +11,13 @@ import { useAppConfig, useNuxtApp, useRuntimeConfig, useState, useContentState,

const useDefaultAppConfig = createSingleton(() => JSON.parse(JSON.stringify((useAppConfig()))))

const defu = createDefu((obj, key, value) => {
if (Array.isArray(obj[key]) && Array.isArray(value)) {
obj[key] = value
return true
}
})

export const useStudio = () => {
const nuxtApp = useNuxtApp()
const { studio: studioConfig, content: contentConfig } = useRuntimeConfig().public
Expand Down

0 comments on commit 869f61e

Please sign in to comment.