Skip to content

Commit 231ef50

Browse files
committed
fix(preview): handle deleted key in object
1 parent 856f386 commit 231ef50

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/internal/preview/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ export function deepDelete(obj: Record<string, unknown>, newObj: Record<string,
3939
export function deepAssign(obj: Record<string, unknown>, newObj: Record<string, unknown>) {
4040
for (const key in newObj) {
4141
const val = newObj[key]
42+
if (val === '_DELETED_') {
43+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
44+
delete obj[key]
45+
continue
46+
}
47+
4248
if (val !== null && typeof val === 'object') {
4349
// Replace array types
4450
if (Array.isArray(val) && Array.isArray(obj[key])) {

0 commit comments

Comments
 (0)