Skip to content

fix(pages): pass through any Response returned from page loaders - #37

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/pages-loader-response-passthrough
Mar 27, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/pages-loader-response-passthrough

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Mar 26, 2026 •

Copy link
Copy Markdown
Member

Previously, handlePageGet only short-circuited for Response objects
with status >= 300 (redirects, 4xx, 5xx). A loader returning a 200
Response (e.g. for content negotiation like Accept: text/markdown)
would fall through to extractProps(), which crashes because it
expects a plain object, not a Response.

Now any Response returned from a loader is passed through directly,
regardless of status code. This enables loaders to return custom
responses for content negotiation, streaming, or other use cases.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com


Note

Medium Risk
Changes loader return-value handling so some Response objects now bypass props extraction, which could affect existing loaders relying on previous behavior (especially around JSON/content-type detection). Adds runtime tracking of framework-generated responses, so mis-tagging could change whether a response is unwrapped vs returned directly.

Overview
Page loaders can now return custom Responses without crashing. handlePageGet now passes through user-constructed Responses for redirects/errors and for non-JSON 200 responses (e.g. downloads/streams), while still extracting props from JSON responses for backward compatibility.

Framework-generated responses are explicitly tracked. convertReturnValue now tags its created responses (via a WeakSet + isConvertedResponse) so handlePageGet can safely unwrap those into page props.

Separately, the SSR renderer’s serializePageData switches to a single regex-based escape pass for <, >, &, and Unicode line separators.

Written by Cursor Bugbot for commit e116244. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abea7c0309

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/void/src/pages/protocol.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread packages/void/src/pages/protocol.ts Outdated
@Brooooooklyn
Brooooooklyn force-pushed the fix/pages-loader-response-passthrough branch 2 times, most recently from 906d90e to af14340 Compare March 27, 2026 02:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af143404b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/void/src/pages/protocol.ts Outdated
@Brooooooklyn
Brooooooklyn force-pushed the fix/pages-loader-response-passthrough branch from af14340 to ad156b7 Compare March 27, 2026 02:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad156b71a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/void/src/pages/protocol.ts
Previously, handlePageGet only short-circuited for Response objects
with status >= 300 (redirects, 4xx, 5xx). A loader returning a 200
Response (e.g. for content negotiation like Accept: text/markdown)
would fall through to extractProps(), which crashes because it
expects a plain object, not a Response.

Now any Response returned from a loader is passed through directly,
regardless of status code. This enables loaders to return custom
responses for content negotiation, streaming, or other use cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Brooooooklyn
Brooooooklyn force-pushed the fix/pages-loader-response-passthrough branch from ad156b7 to e116244 Compare March 27, 2026 03:10
@Brooooooklyn
Brooooooklyn merged commit cbcb4e7 into main Mar 27, 2026
8 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/pages-loader-response-passthrough branch March 27, 2026 03:44
cpojer pushed a commit that referenced this pull request Sep 11, 2026
…entical deploys (#37)

* fix(api): retry CF asset session on plain-text response and dedupe identical deploys

CF's WfP assets-upload-session API intermittently returns plain text
("Assets have already been uploaded") instead of JSON when all asset
hashes already exist. This varies by edge node and causes deploys to
fail with "Unexpected token 'A'" JSON parse errors.

Two fixes:

1. Retry: createAssetUploadSession now retries up to 3 times with
   backoff (1s, 2s, 3s) when CF returns plain text. HTTP errors still
   fail immediately.

2. Dedupe: Before creating a deployment record, the deploy handler
   compares manifest + asset hashes + secrets state with the current
   live deployment. If identical, returns immediately without any CF
   API calls. This handles the common case of CI redeploying unchanged
   code (e.g. same commit daily).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(api): move dedupe before quota check, drop secrets comparison

Address two review comments:

1. Move the identical-deploy fast path before the daily quota check
   so users at their deploy limit still get instant skips for unchanged
   deploys instead of 429.

2. Remove hasSecretsChangedSince from the dedupe gate. The secrets API
   already live-pushes values to the active worker via putWorkerSecret.
   If that push fails the user gets a 502 and should retry the secret
   PUT, not redeploy. Keeping the check caused unnecessary full deploys
   after every secret rotation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant