Skip to content

Commit 2a4d608

Browse files
committed
Fix incorrect argument order in JSON merging functions
Reversed the argument order in `customDefu` and JSON merging logic to ensure proper overwriting precedence. This ensures incoming settings correctly take priority over current settings where applicable.
1 parent 7c4ced5 commit 2a4d608

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/load/load-settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function mergeArrays(key: string, current: any[], incoming: any[]): any[] {
4646

4747
function mergeJsonStrings(current: string, incoming: string): string {
4848
try {
49-
return JSON.stringify(customDefu(JSON.parse(current), JSON.parse(incoming)))
49+
return JSON.stringify(customDefu(JSON.parse(incoming), JSON.parse(current)))
5050
} catch {
5151
return incoming // If not valid JSON, return the incoming value
5252
}
@@ -57,7 +57,7 @@ export default async function loadSettings(dir: string) {
5757
const settings = readFile('settings', dir)
5858
try {
5959
const currentSettings = await api.client.request(readSettings())
60-
const mergedSettings = customDefu(currentSettings, settings) as DirectusSettings
60+
const mergedSettings = customDefu(settings, currentSettings) as DirectusSettings
6161
await api.client.request(updateSettings(mergedSettings))
6262
} catch (error) {
6363
catchError(error)

0 commit comments

Comments
 (0)