Skip to content

Releases: withastro/astro

[email protected]

13 Nov 14:22
3b3bc9b
Compare
Choose a tag to compare

Patch Changes

  • #12420 acac0af Thanks @ematipico! - Fixes an issue where the dev server returns a 404 status code when a user middleware returns a valid Response.

[email protected]

13 Nov 00:02
e723e9e
Compare
Choose a tag to compare

Patch Changes

  • #12305 f5f7109 Thanks @florian-lefebvre! - Fixes a case where the error overlay would not escape the message

  • #12402 823e73b Thanks @ematipico! - Fixes a case where Astro allowed to call an action without using Astro.callAction. This is now invalid, and Astro will show a proper error.

    ---
    import { actions } from "astro:actions";
    
    -const result = actions.getUser({ userId: 123 });
    +const result = Astro.callAction(actions.getUser, { userId: 123 });
    ---
  • #12401 9cca108 Thanks @bholmesdev! - Fixes unexpected 200 status in dev server logs for action errors and redirects.

[email protected]

13 Nov 14:33
b745e38
Compare
Choose a tag to compare
[email protected] Pre-release
Pre-release

Minor Changes

  • #12373 d10f918 Thanks @bholmesdev! - Changes the default behavior for Astro Action form requests to a standard POST submission.

    In Astro 4.x, actions called from an HTML form would trigger a redirect with the result forwarded using cookies. This caused issues for large form errors and return values that exceeded the 4 KB limit of cookie-based storage.

    Astro 5.0 now renders the result of an action as a POST result without any forwarding. This will introduce a "confirm form resubmission?" dialog when a user attempts to refresh the page, though it no longer imposes a 4 KB limit on action return value.

    Customize form submission behavior

    If you prefer to address the "confirm form resubmission?" dialog on refresh, or to preserve action results across sessions, you can now customize action result handling from middleware.

    We recommend using a session storage provider as described in our Netlify Blob example. However, if you prefer the cookie forwarding behavior from 4.X and accept the 4 KB size limit, you can implement the pattern as shown in this sample snippet:

    // src/middleware.ts
    import { defineMiddleware } from 'astro:middleware';
    import { getActionContext } from 'astro:actions';
    
    export const onRequest = defineMiddleware(async (context, next) => {
      // Skip requests for prerendered pages
      if (context.isPrerendered) return next();
    
      const { action, setActionResult, serializeActionResult } = getActionContext(context);
    
      // If an action result was forwarded as a cookie, set the result
      // to be accessible from `Astro.getActionResult()`
      const payload = context.cookies.get('ACTION_PAYLOAD');
      if (payload) {
        const { actionName, actionResult } = payload.json();
        setActionResult(actionName, actionResult);
        context.cookies.delete('ACTION_PAYLOAD');
        return next();
      }
    
      // If an action was called from an HTML form action,
      // call the action handler and redirect with the result as a cookie.
      if (action?.calledFrom === 'form') {
        const actionResult = await action.handler();
    
        context.cookies.set('ACTION_PAYLOAD', {
          actionName: action.name,
          actionResult: serializeActionResult(actionResult),
        });
    
        if (actionResult.error) {
          // Redirect back to the previous page on error
          const referer = context.request.headers.get('Referer');
          if (!referer) {
            throw new Error('Internal: Referer unexpectedly missing from Action POST request.');
          }
          return context.redirect(referer);
        }
        // Redirect to the destination page on success
        return context.redirect(context.originPathname);
      }
    
      return next();
    });

Patch Changes

  • #12339 bdb75a8 Thanks @ematipico! - Adds an error when Astro.rewrite() is used to rewrite an on-demand route with a static route when using the "server" output.

    This is a forbidden rewrite because Astro can't retrieve the emitted static route at runtime. This route is served by the hosting platform, and not Astro itself.

[email protected]

06 Nov 14:57
e10b03e
Compare
Choose a tag to compare

Patch Changes

  • #12311 bf2723e Thanks @dinesh-58! - Adds checked to the list of boolean attributes.

  • #12363 222f718 Thanks @Fryuni! - Fixes code generated by astro add command when adding a version of an integration other than the default latest.

  • #12368 493fe43 Thanks @bluwy! - Improves error logs when executing commands

  • #12355 c4726d7 Thanks @apatel369! - Improves error reporting for invalid frontmatter in MDX files during the astro build command. The error message now includes the file path where the frontmatter parsing failed.

@astrojs/[email protected]

06 Nov 14:57
e10b03e
Compare
Choose a tag to compare

Patch Changes

  • #12390 6fd3d59 Thanks @bluwy! - Adds support for Svelte 5's new @render syntax while maintaining backward compatibility with traditional slots.

[email protected]

06 Nov 15:49
d63d87d
Compare
Choose a tag to compare
[email protected] Pre-release
Pre-release

Minor Changes

  • #12083 9263e96 Thanks @Princesseuh! - Reworks the experience of creating a new Astro project using the create astro CLI command.

    • Updates the list of templates to include Starlight and combines the "minimal" and "basics" templates into a new, refreshed "Basics" template to serve as the single, minimal Astro project starter.
    • Removes the TypeScript question. Astro is TypeScript-only, so this question was often misleading. The "Strict" preset is now the default, but it can still be changed manually in tsconfig.json.
    • astro check is no longer automatically added to the build script.
    • Added a new --add flag to install additional integrations after creating a project. For example, pnpm create astro --add react will create a new Astro project and install the React integration.

[email protected]

06 Nov 15:49
d63d87d
Compare
Choose a tag to compare
[email protected] Pre-release
Pre-release

Minor Changes

@astrojs/[email protected]

06 Nov 15:49
d63d87d
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • b21a075 Thanks @bluwy! - New release to include changes from 5.7.3

[email protected]

04 Nov 14:22
ec3113d
Compare
Choose a tag to compare

Patch Changes

[email protected]

31 Oct 07:58
5f7bf49
Compare
Choose a tag to compare

Patch Changes

  • #12338 9ca89b3 Thanks @situ2001! - Resets NODE_ENV to ensure install command run in dev mode

  • #12286 9d6bcdb Thanks @florian-lefebvre! - Fixes a case where a warning for experimental astro:env support would be shown when using an adapter but not actually using astro:env

  • #12342 ffc836b Thanks @liruifengv! - Fixes a typo in the command name of the CLI

  • #12301 0cfc69d Thanks @apatel369! - Fixes an issue with action handler context by passing the correct context (ActionAPIContext).

  • #12312 5642ef9 Thanks @koyopro! - Fixes an issue where using getViteConfig() returns incorrect and duplicate configuration

  • #12245 1d4f6a4 Thanks @bmenant! - Add components property to MDXInstance type definition (RenderResult and module import)

  • #12340 94eaeea Thanks @ematipico! - Fixes an issue where Astro actions didn't work when base was different from /