diff --git a/packages/vue/CHANGELOG.md b/packages/vue/CHANGELOG.md index dfd26d61a..3152a4d6c 100644 --- a/packages/vue/CHANGELOG.md +++ b/packages/vue/CHANGELOG.md @@ -1,5 +1,11 @@ # @effect-app/vue +## 2.12.0 + +### Minor Changes + +- fix: input-less action is just an effect. + ## 2.11.0 ### Minor Changes diff --git a/packages/vue/package.json b/packages/vue/package.json index 5a939191d..3fbc0ddcb 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@effect-app/vue", - "version": "2.11.0", + "version": "2.12.0", "license": "MIT", "type": "module", "homepage": "https://github.com/effect-ts-app/libs/tree/main/packages/vue", diff --git a/packages/vue/src/makeClient2.ts b/packages/vue/src/makeClient2.ts index 3af7fcf7f..87fe278a8 100644 --- a/packages/vue/src/makeClient2.ts +++ b/packages/vue/src/makeClient2.ts @@ -30,7 +30,7 @@ type Resp = readonly [ type ActResp = readonly [ ComputedRef>, - WithAction<() => Effect, never, R>> + WithAction, never, R>> ] export const makeClient2 = ( @@ -60,7 +60,7 @@ export const makeClient2 = ( R, Args extends unknown[] >( - f: (...args: Args) => Effect, + f: Effect | ((...args: Args) => Effect), action: string, options: Opts = { suppressErrorToast: false } ) { @@ -77,9 +77,8 @@ export const makeClient2 = ( { id: "handle.with_errors" }, { action: message } ) - return Object.assign( - flow( - f, + const handleEffect = (self: Effect) => + self.pipe( Effect.exit, Effect.tap( Exit.matchEffect({ @@ -143,7 +142,17 @@ export const makeClient2 = ( }) }) ) - ), + ) + return Object.assign( + Effect.isEffect(f) + ? pipe( + f, + handleEffect + ) + : flow( + f, + handleEffect + ), { action } ) }