reactive/data-client / .agents/skills/data-client-manager
data-client-manager
VerifiedWrite @data-client Managers, the runtime layer that bridges the store to the world outside the view framework: global side effects and real-time data such as websockets, SSE and polling. A Manager reacts to every request or to events from outside the app, and moves data into or out of the store. Use one instead of useEffect for behavior that belongs to the whole app, such as error toasts and reporting, logging and analytics, auth failures, refetching on focus or reconnect, and cross-tab sync. Not for the shape of data: data built from responses (joined, derived, or accumulated) is defined in a schema, so use data-client-schema.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 13.1 KB |
| evals/evals.json | config | 12.5 KB |
| references.json | config | 388 B |
| references/Actions.md | markdown | 5.6 KB |
| references/Actions.vue.md | markdown | 5.6 KB |
| references/Controller.md | markdown | 34.1 KB |
| references/Controller.vue.md | markdown | 24.3 KB |
| references/LogoutManager.md | markdown | 3.8 KB |
| references/LogoutManager.vue.md | markdown | 2.1 KB |
| references/Manager.md | markdown | 11.1 KB |
| references/Manager.vue.md | markdown | 8.4 KB |
| references/getDefaultManagers.md | markdown | 6.1 KB |
| references/getDefaultManagers.vue.md | markdown | 3.8 KB |
| references/managers.md | markdown | 22.3 KB |
| references/managers.vue.md | markdown | 16.6 KB |
references/getDefaultManagers.vue.md
View on GitHub<!-- Generated by `yarn build:skills` from docs/core/api/getDefaultManagers.md (vue). Edit the source doc, not this file. -->
# getDefaultManagers()
`getDefaultManagers` returns new instances of the default [Managers](./Manager.vue.md). Call it in the
[managers](https://dataclient.io/vue/api/DataClientPlugin#managers) function, so each store
gets its own.
This makes it simple to configure and add custom [Managers](./Manager.vue.md), while remaining robust against
any potential changes to the default managers.
Currently returns \[[DevToolsManager](https://dataclient.io/vue/api/DevToolsManager)\*, [NetworkManager](https://dataclient.io/vue/api/NetworkManager), [SubscriptionManager](https://dataclient.io/vue/api/SubscriptionManager)].
\*(`DevToolsManager` is excluded in production builds.)
## Usage
```ts title="main.ts"
import { createApp } from 'vue';
import { DataClientPlugin, getDefaultManagers } from '@data-client/vue';
import App from './App.vue';
const managers = () => getDefaultManagers({
// set fallback expiry time to an hour
networkManager: { dataExpiryLength: 1000 * 60 * 60 },
});
const app = createApp(App);
app.use(DataClientPlugin, { managers });
app.mount('#app');
```
When `managers` is omitted, `DataClientPlugin` uses `getDefaultManagers()` with no arguments.
See [DataClientPlugin](https://dataclient.io/vue/api/DataClientPlugin#options) for the
other options.
## Arguments
Each argument represents a configuration of the manager. It can be of three possible types:
- Any plain object is used as options to be sent to the manager's constructor.
- An instance of the manager to be used directly.
- `null`. When sent will exclude the manager.
```ts
getDefaultManagers({
devToolsManager: { trace: true },
networkManager: new NetworkManager({ errorExpiryLength: 1 }),
subscriptionManager: null,
});
```
### networkManager
> **Note**
>
> `null` is not allowed here since NetworkManager is required
`dataExpiryLength` is used as a fallback when an Endpoint does not have [dataExpiryLength](https://dataclient.io/docs/concepts/expiry-policy#endpointdataexpirylength) defined.
`errorExpiryLength` is used as a fallback when an Endpoint does not have [errorExpiryLength](https://dataclient.io/docs/concepts/expiry-policy#endpointerrorexpirylength) defined.
### devToolsManager
[Arguments](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md)
to send to redux devtools.
### subscriptionManager
A class that implements `SubscriptionConstructable` like [PollingSubscription](https://dataclient.io/vue/api/PollingSubscription)
## Examples
### Tracing actions
For example, we can enable the [trace](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md#trace) option to help track down where actions are dispatched from. This has a large performance impact, so it is normally disabled.
```ts
const managers = () => getDefaultManagers({
devToolsManager: { trace: true },
});
```
### Manager inheritance
Sending manager instances allows us to customize managers using inheritance.
```ts
import {
NetworkManager,
getDefaultManagers,
type FetchAction,
} from '@data-client/vue';
class LoggingNetworkManager extends NetworkManager {
protected handleFetch(action: FetchAction) {
console.log('fetching', action.key);
return super.handleFetch(action);
}
}
const managers = () => getDefaultManagers({
networkManager: new LoggingNetworkManager(),
});
```
### Disabling
Using `null` will remove managers completely. [NetworkManager](https://dataclient.io/vue/api/NetworkManager) cannot be removed this way.
```ts
const managers = () => getDefaultManagers({
devToolsManager: null,
subscriptionManager: null,
});
```
Here we disable every manager except [NetworkManager](https://dataclient.io/vue/api/NetworkManager).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |