From 2a09db3094a777878f7e2ff97ca6efb382b50009 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 9 Dec 2024 16:37:12 +0700 Subject: [PATCH 1/2] Fix when no result --- packages/integrations/react/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 9c3c309cc00c..f9ad5e4f97dd 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -85,7 +85,7 @@ async function renderToStaticMarkup(Component, props, { default: children, ...sl value: newChildren, }); } - const formState = this ? await getFormState(this) : undefined; + const formState = this?.result ? await getFormState(this) : undefined; if (formState) { attrs['data-action-result'] = JSON.stringify(formState[0]); attrs['data-action-key'] = formState[1]; From 0f7f3e2c452e8b9593bfe90e15f8f1b5e2dbba87 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 9 Dec 2024 16:49:44 +0700 Subject: [PATCH 2/2] Create fix-this-result.md --- .changeset/fix-this-result.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-this-result.md diff --git a/.changeset/fix-this-result.md b/.changeset/fix-this-result.md new file mode 100644 index 000000000000..dc3c0acba897 --- /dev/null +++ b/.changeset/fix-this-result.md @@ -0,0 +1,5 @@ +--- +'@astrojs/react': patch +--- + +fix: break if no result for getFormState