# DevToolsManager

```typescript
class DevToolsManager implements Manager
```

Integrates with [Redux DevTools](https://github.com/reduxjs/redux-devtools) to track
state and [actions](https://dataclient.io/vue/api/Actions.md). Note: does not integrate time-travel.

Add the [chrome extension](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en)
or [firefox extension](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/) to your
browser to get started.

> **Info: implements**
>
> `DevToolsManager` implements [Manager](https://dataclient.io/vue/api/Manager.md)

## constructor(options?, skipLogging?)

### options

[Arguments](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md)
to send to redux devtools.

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.

```ts title="main.ts"
import { createApp } from 'vue';
import { DataClientPlugin, getDefaultManagers } from '@data-client/vue';
import App from './App.vue';

const managers = getDefaultManagers({
  devToolsManager: { trace: true },
});

const app = createApp(App);
app.use(DataClientPlugin, { managers });
app.mount('#app');
```

### skipLogging

`(action: ActionTypes) => boolean`

Can skip some actions to be registered in the browser devtool.

By default will skip inflight [fetch actions](https://dataclient.io/vue/api/Controller.md#fetch)

```ts title="main.ts"
import { createApp } from 'vue';
import {
  DataClientPlugin,
  DevToolsManager,
  getDefaultManagers,
} from '@data-client/vue';
import App from './App.vue';

// production builds leave out DevToolsManager
const managers = getDefaultManagers({
  devToolsManager: new DevToolsManager(undefined, () => true),
});

const app = createApp(App);
app.use(DataClientPlugin, { managers });
app.mount('#app');
```

#### Skipping high-frequency updates

When using [WebSockets](https://dataclient.io/vue/concepts/managers.md#data-stream) or other real-time data sources,
high-frequency updates can overwhelm the DevTools extension. Use the `predicate` option to
filter out specific action types or schemas:

```ts title="managers.ts"
import { getDefaultManagers, actionTypes } from '@data-client/vue';
import { Ticker } from './resources/Ticker';

const managers = getDefaultManagers({
  devToolsManager: {
    // Increase latency buffer for high-frequency updates
    latency: 1000,
    // Skip WebSocket SET actions for Ticker to reduce log spam
    // (including batched set([Ticker], rows) writes)
    predicate: (state, action) =>
      action.type !== actionTypes.SET ||
      (action.schema !== Ticker && action.schema[0] !== Ticker),
  },
});
```

## Programmatic store access {#controllers}

In development mode, `DevToolsManager` registers each [Controller](https://dataclient.io/vue/api/Controller.md) on
`globalThis.__DC_CONTROLLERS__` — a `Map` keyed by the devtools connection name. This works
in browsers, React Native, and Node.

```js title="Browser DevTools console"
// List all registered providers
__DC_CONTROLLERS__.keys();

// Get state from the first provider
__DC_CONTROLLERS__.values().next().value.getState();

// Get state by name
__DC_CONTROLLERS__.get('Data Client: My App').getState();
```

This is useful for AI coding assistants using the [Chrome DevTools MCP](https://developer.chrome.com/blog/chrome-devtools-mcp)
or [Expo MCP](https://docs.expo.dev/eas/ai/mcp/) to programmatically inspect and interact
with the store. Each installed [DataClientPlugin](https://dataclient.io/vue/api/DataClientPlugin.md) registers independently, so
multiple apps on the same page are fully supported.

Controllers are removed from the map when `cleanup()` is called.

## More info

Using this Manager allows in browser [debugging and store inspection](https://dataclient.io/vue/getting-started/debugging.md).
