Skip to content

reactive/data-client / .agents/skills/data-client-setup

data-client-setup

Verified

Install 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.

FileKindSize
SKILL.mdskill md13.9 KB
evals/evals.jsonconfig12.6 KB
references.jsonconfig523 B
references/DataClientPlugin.mdmarkdown6.6 KB
references/DataProvider.mdmarkdown6.6 KB
references/data-client-endpoint-setup.mdmarkdown8.5 KB
references/data-client-endpoint-setup/references/Endpoint.mdmarkdown20.9 KB
references/data-client-endpoint-setup/references/Endpoint.vue.mdmarkdown20.5 KB
references/data-client-graphql-setup.mdmarkdown4.8 KB
references/data-client-graphql-setup/references/auth.mdmarkdown1.9 KB
references/data-client-rest-setup.mdmarkdown7.6 KB
references/data-client-rest-setup/references/RestEndpoint.mdmarkdown45.2 KB
references/data-client-rest-setup/references/RestEndpoint.vue.mdmarkdown46.1 KB
references/data-client-rest-setup/references/auth.mdmarkdown9.4 KB
references/data-client-rest-setup/references/auth.vue.mdmarkdown9.7 KB
references/data-client-rest-setup/references/axios-migration.mdmarkdown25.4 KB
references/data-client-rest-setup/references/axios-migration.vue.mdmarkdown25.5 KB
references/data-client-rest-setup/references/django.mdmarkdown2.3 KB
references/data-client-rest-setup/references/fetch-migration.mdmarkdown4.0 KB
references/data-client-rest-setup/references/got-migration.mdmarkdown4.5 KB
references/data-client-rest-setup/references/hookifyResource.mdmarkdown6.0 KB
references/data-client-rest-setup/references/hookifyResource.vue.mdmarkdown6.3 KB
references/data-client-rest-setup/references/ky-migration.mdmarkdown3.9 KB
references/data-client-rest-setup/references/resource.mdmarkdown27.0 KB
references/data-client-rest-setup/references/resource.vue.mdmarkdown27.1 KB
references/data-client-rest-setup/references/superagent-migration.mdmarkdown4.1 KB
references/getDefaultManagers.mdmarkdown6.1 KB
references/getDefaultManagers.vue.mdmarkdown3.8 KB
references/installation.mdmarkdown4.0 KB
references/installation.vue.mdmarkdown2.7 KB
references/tanstack-query-migration.mdmarkdown31.1 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](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).
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall