From d5bd1628b396c6d8cdd530906cdc8e77f0347782 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Fri, 7 Mar 2025 15:08:19 +0100 Subject: [PATCH] docs: add description to the action helper --- packages/pinia/src/store.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index a7be113c..bed44b20 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -780,7 +780,15 @@ export type StoreState = : _ExtractStateFromSetupStore export interface SetupStoreHelpers { - action: (fn: Fn) => Fn + /** + * Helper that wraps function so it can be tracked with $onAction when the + * action is called **within the store**. This helper is rarely needed in + * applications. It's intended for advanced use cases like Pinia Colada. + * + * @param fn - action to wrap + * @param name - name of the action. Will be picked up by the store at creation + */ + action: (fn: Fn, name?: string) => Fn } /** -- 2.47.3