From e6dd31f9ad95ee69485c32ae2645b1ff02fa0e9f Mon Sep 17 00:00:00 2001 From: ido Date: Sun, 24 Dec 2023 18:50:57 +0200 Subject: [PATCH] fix: parse first state --- .../forms/src/components-control/form-utils/view-state.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/forms/src/components-control/form-utils/view-state.ts b/packages/forms/src/components-control/form-utils/view-state.ts index 8b9dbbb..ed901d3 100644 --- a/packages/forms/src/components-control/form-utils/view-state.ts +++ b/packages/forms/src/components-control/form-utils/view-state.ts @@ -39,14 +39,14 @@ export default class ViewStateManager { private async _extractStateFromForm() { const form = await parseFormData(this._astro.request); - const value = form.get(this.filedName).toString(); - form.delete(this.filedName); - return value; + return form.get(this.filedName)?.toString(); } private async _parseState() { try { const state = await this._extractStateFromForm(); + if(state == null) return; + const data = this._cryptr.decrypt(state); const uncompress = await snappy.uncompress(Buffer.from(data, 'base64')); return superjson.parse(uncompress.toString());