Skip to content

Commit e840333

Browse files
florian-lefebvreArmandPhilippotsarah11918
authored
[v6] clean deprecated APIs (#12469)
Co-authored-by: Armand Philippot <git@armand.philippot.eu> Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
1 parent 43e9116 commit e840333

File tree

1 file changed

+68
-0
lines changed
  • src/content/docs/en/guides/upgrade-to

1 file changed

+68
-0
lines changed

src/content/docs/en/guides/upgrade-to/v6.mdx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,74 @@ const integration = () => {
301301
}
302302
```
303303

304+
### Removed: old `app.render()` signature (Adapter API)
305+
306+
<SourcePR number="14462" title="feat: clean deprecated APIs"/>
307+
308+
In Astro 4.0, the `app.render()` signature that allowed passing `routeData` and `locals` as optional arguments was deprecated in favor of a single optional `renderOptions` argument.
309+
310+
Astro 6.0 removes this signature entirely. Attempting to pass these separate arguments will now cause an error in your project.
311+
312+
#### What should I do?
313+
314+
Review your `app.render` calls and pass `routeData` and `locals` as properties of an object instead of as multiple independent arguments:
315+
316+
```ts title="my-adapter/entrypoint.ts" del={1} ins={2}
317+
app.render(request, routeData, locals)
318+
app.render(request, { routeData, locals })
319+
```
320+
321+
<ReadMore>Learn more about the [Adapter API](/en/reference/adapter-reference/).</ReadMore>
322+
323+
### Removed: `handleForms` prop for the `<ClientRouter />` component
324+
325+
<SourcePR number="14462" title="feat: clean deprecated APIs"/>
326+
327+
In Astro 4.0, the `handleForms` prop of the `<ClientRouter />` component was deprecated, as it was no longer necessary to opt in to handling `submit` events for `form` elements. This functionality has been built-in by default and the property, if still included in your project, silently had no impact on form submission.
328+
329+
Astro 6.0 removes this prop entirely and it now must be removed to avoid errors in your project.
330+
331+
#### What should I do?
332+
333+
Remove the `handleForms` property from your `<ClientRouter />` component if it exists. It has provided no additional functionality, and so removing it should not change any behavior in your project:
334+
335+
```astro title="src/pages/index.astro" del="handleForms"
336+
---
337+
import { ClientRouter } from "astro:transitions";
338+
---
339+
<html>
340+
<head>
341+
<ClientRouter handleForms />
342+
</head>
343+
<body>
344+
<!-- stuff here -->
345+
</body>
346+
</html>
347+
```
348+
349+
<ReadMore>Learn more about [transitions with forms](/en/guides/view-transitions/#transitions-with-forms).</ReadMore>
350+
351+
### Removed: `prefetch()` `with` option
352+
353+
<SourcePR number="14462" title="feat: clean deprecated APIs"/>
354+
355+
In Astro 4.8.4, the `with` option of the programmatic `prefetch()` function was deprecated in favor of a more sensible default behavior that no longer required specifying the priority of prefetching for each page.
356+
357+
Astro 6.0 removes this option entirely and it is no longer possible to configure the priority of prefetching by passing the `with` option. Attempting to do so will now cause errors.
358+
359+
By default, Astro's prefetching now uses an automatic approach that will always try to use `<link rel="prefetch>` if supported, or will fall back to `fetch()`.
360+
361+
#### What should I do?
362+
363+
Review your `prefetch()` calls and remove the `with` option if it still exists:
364+
365+
```ts
366+
prefetch('/about', { with: 'fetch' });
367+
prefetch('/about');
368+
```
369+
370+
<ReadMore>Learn more about [prefetching](/en/guides/prefetch/).</ReadMore>
371+
304372
## Changed Defaults
305373

306374
Some default behavior has changed in Astro v5.0 and your project code may need updating to account for these changes.

0 commit comments

Comments
 (0)