diff options
Diffstat (limited to 'packages/integrations')
-rw-r--r-- | packages/integrations/react/CHANGELOG.md | 47 | ||||
-rw-r--r-- | packages/integrations/react/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/vue/CHANGELOG.md | 22 | ||||
-rw-r--r-- | packages/integrations/vue/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/web-vitals/CHANGELOG.md | 6 | ||||
-rw-r--r-- | packages/integrations/web-vitals/package.json | 2 |
6 files changed, 78 insertions, 3 deletions
diff --git a/packages/integrations/react/CHANGELOG.md b/packages/integrations/react/CHANGELOG.md index 8b12f15e9..707cbe033 100644 --- a/packages/integrations/react/CHANGELOG.md +++ b/packages/integrations/react/CHANGELOG.md @@ -1,5 +1,52 @@ # @astrojs/react +## 3.4.0 + +### Minor Changes + +- [#11071](https://github.com/withastro/astro/pull/11071) [`8ca7c73`](https://github.com/withastro/astro/commit/8ca7c731dea894e77f84b314ebe3a141d5daa918) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Adds two new functions `experimental_getActionState()` and `experimental_withState()` to support [the React 19 `useActionState()` hook](https://react.dev/reference/react/useActionState) when using Astro Actions. This introduces progressive enhancement when calling an Action with the `withState()` utility. + + This example calls a `like` action that accepts a `postId` and returns the number of likes. Pass this action to the `experimental_withState()` function to apply progressive enhancement info, and apply to `useActionState()` to track the result: + + ```tsx + import { actions } from 'astro:actions'; + import { experimental_withState } from '@astrojs/react/actions'; + + export function Like({ postId }: { postId: string }) { + const [state, action, pending] = useActionState( + experimental_withState(actions.like), + 0 // initial likes + ); + + return ( + <form action={action}> + <input type="hidden" name="postId" value={postId} /> + <button disabled={pending}>{state} ❤️</button> + </form> + ); + } + ``` + + You can also access the state stored by `useActionState()` from your action `handler`. Call `experimental_getActionState()` with the API context, and optionally apply a type to the result: + + ```ts + import { defineAction, z } from 'astro:actions'; + import { experimental_getActionState } from '@astrojs/react/actions'; + + export const server = { + like: defineAction({ + input: z.object({ + postId: z.string(), + }), + handler: async ({ postId }, ctx) => { + const currentLikes = experimental_getActionState<number>(ctx); + // write to database + return currentLikes + 1; + }, + }), + }; + ``` + ## 3.3.4 ### Patch Changes diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 373e8f848..3a5b6b6bf 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/react", "description": "Use React components within Astro", - "version": "3.3.4", + "version": "3.4.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/vue/CHANGELOG.md b/packages/integrations/vue/CHANGELOG.md index b1f95541d..acef2a55e 100644 --- a/packages/integrations/vue/CHANGELOG.md +++ b/packages/integrations/vue/CHANGELOG.md @@ -1,5 +1,27 @@ # @astrojs/vue +## 4.3.0 + +### Minor Changes + +- [#11055](https://github.com/withastro/astro/pull/11055) [`b92de22`](https://github.com/withastro/astro/commit/b92de22d2853efc4da4270a3812b9db120d06d3a) Thanks [@niklas-wortmann](https://github.com/niklas-wortmann)! - Updates the `devtools` type to allow passing `VueDevToolsOptions` + + For more customization, you can pass options that the [Vue DevTools Vite Plugin](https://devtools-next.vuejs.org/guide/vite-plugin#options) supports. (Note: `appendTo` is not supported.) For example, you can set `launchEditor` to your preferred editor if you are not using Visual Studio Code: + + ```js title="astro.config.mjs" + import { defineConfig } from 'astro/config'; + import vue from '@astrojs/vue'; + + export default defineConfig({ + // ... + integrations: [ + vue({ + devtools: { launchEditor: 'webstorm' }, + }), + ], + }); + ``` + ## 4.2.0 ### Minor Changes diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 4540e3eac..2381f9a86 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/vue", - "version": "4.2.0", + "version": "4.3.0", "description": "Use Vue components within Astro", "type": "module", "types": "./dist/index.d.ts", diff --git a/packages/integrations/web-vitals/CHANGELOG.md b/packages/integrations/web-vitals/CHANGELOG.md index 26f4cd1a6..38b9bc1f6 100644 --- a/packages/integrations/web-vitals/CHANGELOG.md +++ b/packages/integrations/web-vitals/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/web-vitals +## 0.2.1 + +### Patch Changes + +- [#11120](https://github.com/withastro/astro/pull/11120) [`9a0e94b`](https://github.com/withastro/astro/commit/9a0e94b2e6bc41b370d8a0518004c6f3cb1b833e) Thanks [@delucis](https://github.com/delucis)! - Fixes requests to the web vitals endpoint in setups like Vercel’s `trailingSlash: true` that redirect from `/web-vitals` to `/web-vitals/` + ## 0.2.0 ### Minor Changes diff --git a/packages/integrations/web-vitals/package.json b/packages/integrations/web-vitals/package.json index f867cf182..a4ef90ede 100644 --- a/packages/integrations/web-vitals/package.json +++ b/packages/integrations/web-vitals/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/web-vitals", "description": "Track your website’s performance with Astro DB", - "version": "0.2.0", + "version": "0.2.1", "type": "module", "author": "withastro", "license": "MIT", |