Skip to content

fix: access remote_responses cache lazily in form remote functions #14121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

eltigerchino
Copy link
Member

@eltigerchino eltigerchino commented Aug 6, 2025

fixes #14120

This PR moves the property accessing of the remote_responses object to the result getter so that it isn't evaluated when the remote function is created. This is similar to the query and prerender remote function creations.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

No test because it wouldn't work in the options-2 test app without merging #14120 too. Also, the tests from that PR would cover this as well.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: 59e93e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eltigerchino eltigerchino changed the title fix: access remote_responses cache lazily fix: access remote_responses cache lazily in form remote functions Aug 6, 2025
@svelte-docs-bot
Copy link

@Rich-Harris
Copy link
Member

Is there a race condition that could occur here? If a module imported my_form and eagerly logged my_form.result before the app had started, couldn't it log undefined? Do we need to be more aggressive, e.g. putting hydration data in the __sveltekit_abc123 object?

@Rich-Harris
Copy link
Member

(taking a run at this locally)

@eltigerchino
Copy link
Member Author

closed in favour of #14127

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.

Single output apps with remote form functions throw an error
2 participants