From c0055907f76cf4d9bc7583e09eb305afbb60a404 Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Sun, 28 Apr 2024 22:24:41 +0200 Subject: [PATCH] fix: setValue should work with null (#608) --- packages/conform-dom/formdata.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/conform-dom/formdata.ts b/packages/conform-dom/formdata.ts index 264d39dd..7cf18a37 100644 --- a/packages/conform-dom/formdata.ts +++ b/packages/conform-dom/formdata.ts @@ -120,7 +120,8 @@ export function setValue( const nextKey = paths[index + 1]; const newValue = index != lastIndex - ? Object.prototype.hasOwnProperty.call(pointer, key) + ? Object.prototype.hasOwnProperty.call(pointer, key) && + pointer[key] !== null ? pointer[key] : typeof nextKey === 'number' ? []