Change8

@sveltejs/kit@3.0.0-next.6

Breaking Changes
📦 sveltekitView on GitHub →
7 breaking4 features🐛 4 fixes🔧 7 symbols

Summary

This release introduces significant breaking changes related to form actions, error handling, and configuration origins, alongside new features like form field utilities and bug fixes for request handling.

⚠️ Breaking Changes

  • Responses for 204 status codes will now return no content, instead of potentially returning an empty body.
  • Form action responses now use the HTTP status code returned from the `fail()` function.
  • Nested server-only directories are no longer supported.
  • The configuration option `kit.prerender.origin` and the `adapter-node` environment variable `ORIGIN` have been removed. Use the new `kit.paths.origin` config option instead.
  • Calling `invalidate('All')` during navigation will no longer abort the current navigation.
  • The `handleError` function can now influence the HTTP status code of the response.
  • External redirects are forbidden by default. Configure explicitly if needed.

Migration Steps

  1. If you relied on 204 responses having a body, update your consumers to expect no content.
  2. Review form actions that use `fail()` to ensure the returned status code is what you intend for the HTTP response.
  3. Restructure any nested server-only directories (e.g., `src/routes/foo/server/bar.js` should be refactored).
  4. Replace usage of `kit.prerender.origin` or the `ORIGIN` environment variable with the new `kit.paths.origin` configuration option.
  5. If you relied on `invalidate('All')` aborting navigation, you may need to adjust navigation logic.
  6. If you implemented custom error handling via `handleError`, review how status codes are set.
  7. If you require external redirects, you must now explicitly enable them.
  8. The experimental remote form option `validate({ includeUntouched })` must now use the value `all` instead of its previous experimental value.

✨ New Features

  • Service worker registrations now use `type: 'module'`.
  • Added a `dirty()` property to form fields.
  • Added a `cookies.parse` method.
  • Added a `field.touched()` helper to remote form fields.

🐛 Bug Fixes

  • Unconsumed request bodies are now drained to prevent keep-alive connections from hanging.
  • Date objects are now handled correctly in `form.fields.set`.
  • Programmatically validating forms now correctly skips clean fields.
  • The `fields.branch.issues()` function now returns `undefined` when only `fields.branch.leaf` has issues.

Affected Symbols