fillGlobal: a field already holding the seeded value is skipped, not rewritten
Seeding exactly the default (allowThemeToggle: true) used to count as unset, rewrite it and report create on every run. Now: skip (exists), no write. A choice at its default is still replaced by a different seeded value; editor changes stay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6f56ef4205
commit
37131e9930
@@ -431,7 +431,9 @@ export function createSeeder(payload: BasePayload, options: SeederOptions = {}):
|
||||
const fieldOf = (name: string) => (global?.flattenedFields as { defaultValue?: unknown; name?: string; type?: string }[] | undefined)?.find((f) => f.name === name)
|
||||
const cur = await readSeedTarget(payload, target, defaultLocale)
|
||||
// Empty, or a choice still at its default value (e.g. Theme → light): never text an editor wrote.
|
||||
const empty = Object.keys(data).filter((k) => isUnsetValue(cur[k], fieldOf(k)))
|
||||
// A field already holding exactly the seeded value is left alone (no write, reported as skip).
|
||||
const same = (k: string) => JSON.stringify(cur[k]) === JSON.stringify(localize(data[k], defaultLocale, cur[k], codes))
|
||||
const empty = Object.keys(data).filter((k) => isUnsetValue(cur[k], fieldOf(k)) && !same(k))
|
||||
let keys = empty
|
||||
let edited: null | string = null
|
||||
if (update) {
|
||||
|
||||
Reference in New Issue
Block a user