Skip to content
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

[ci] release #11940

Merged
merged 1 commit into from
Sep 13, 2024
Merged

[ci] release #11940

merged 1 commit into from
Sep 13, 2024

Conversation

astrobot-houston
Copy link
Contributor

@astrobot-houston astrobot-houston commented Sep 6, 2024

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

astro@4.15.5

Patch Changes

  • #11939 7b09c62 Thanks @bholmesdev! - Adds support for Zod discriminated unions on Action form inputs. This allows forms with different inputs to be submitted to the same action, using a given input to decide which object should be used for validation.

    This example accepts either a create or update form submission, and uses the type field to determine which object to validate against.

    import { defineAction } from 'astro:actions';
    import { z } from 'astro:schema';
    
    export const server = {
      changeUser: defineAction({
        accept: 'form',
        input: z.discriminatedUnion('type', [
          z.object({
            type: z.literal('create'),
            name: z.string(),
            email: z.string().email(),
          }),
          z.object({
            type: z.literal('update'),
            id: z.number(),
            name: z.string(),
            email: z.string().email(),
          }),
        ]),
        async handler(input) {
          if (input.type === 'create') {
            // input is { type: 'create', name: string, email: string }
          } else {
            // input is { type: 'update', id: number, name: string, email: string }
          }
        },
      }),
    };

    The corresponding create and update forms may look like this:

    ---
    import { actions } from 'astro:actions';
    ---
    
    <!--Create-->
    <form action={actions.changeUser} method="POST">
      <input type="hidden" name="type" value="create" />
      <input type="text" name="name" required />
      <input type="email" name="email" required />
      <button type="submit">Create User</button>
    </form>
    
    <!--Update-->
    <form action={actions.changeUser} method="POST">
      <input type="hidden" name="type" value="update" />
      <input type="hidden" name="id" value="user-123" />
      <input type="text" name="name" required />
      <input type="email" name="email" required />
      <button type="submit">Update User</button>
    </form>
  • #11968 86ad1fd Thanks @NikolaRHristov! - Fixes a typo in the server island JSDoc

  • #11983 633eeaa Thanks @uwej711! - Remove dependency on path-to-regexp

@astrojs/mdx@3.1.6

Patch Changes

@github-actions github-actions bot added pkg: example Related to an example package (scope) pkg: astro Related to the core `astro` package (scope) labels Sep 6, 2024
@github-actions github-actions bot force-pushed the changeset-release/main branch 6 times, most recently from cdf3f5c to 4a28127 Compare September 13, 2024 10:51
@delucis delucis merged commit 490eed1 into main Sep 13, 2024
@delucis delucis deleted the changeset-release/main branch September 13, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants