reactive/data-client / .agents/skills/data-client-setup
data-client-setup
VerifiedInstall and set up @data-client/react or @data-client/vue in a project. Detects project type (NextJS, Expo, React Native, Vue, plain React) and protocol (REST, GraphQL, custom), then follows the bundled protocol-specific setup guide.
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](https://dataclient.io/vue/api/Manager). Call it in the
[managers](./DataClientPlugin.md#managers) function, so each store
gets its own.
This makes it simple to configure and add custom [Managers](https://dataclient.io/vue/api/Manager), 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](./DataClientPlugin.md#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 |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |