Socket
Book a DemoInstallSign in
Socket

@effector/redux-devtools-adapter

Package Overview
Dependencies
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effector/redux-devtools-adapter

Simple adapter to connect Effector's Inspect API to Redux DevTools

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
903
49.5%
Maintainers
5
Weekly downloads
 
Created
Source

redux-devtools-adapter

Simple adapter to connect Effector's Inspect API to Redux DevTools, extracted from the old effector-logger project.

image

Installation

yarn add -D @effector/redux-devtools-adapter

Usage

Prepare metadata

To make logs more useful we need additional metadata (like names, locations in the code, etc), which is provided by one of the effector plugins.

Babel-plugin

Babel-plugin is built-in in the effector package.

Just add it to your babel configuration.

{
  "plugins": ["effector/babel-plugin"]
}

It is also useful to enable loc generation for dev environment, to see for exact locations of samples and other operators in the code.

{
  "plugins": [["effector/babel-plugin", { "addLoc": true }]]
}

Read the docs

SWC Plugin

Read effector SWC plugin documentation

In the code

Just call attachReduxDevTools() somewhere in your project's entrypoint and you are good to go.

// e.g. src/main.ts
import { attachReduxDevTools } from "@effector/redux-devtools-adapter";

attachReduxDevTools();

You can also provide some additional configuration. All fields are optional.

name

Type: string. Will be visible in the Redux Devtools

scope

Type: Scope Effector's Scope from Fork API, if your app uses it.

See the docs and the article

trace

Type: boolean Enables traces of effector's calculations in the actions. Disabled by default.

batch

Type: boolean | { size: number; latency: number; }. Enables batching of logs at the adapter's side. Redux DevTools are trying to print each and every log they get, which may cause performance issues in the large apps.

With batching enabled adapter sends logs only once in latency milliseconds and with number of logs no more than size number. This means that only last size number of logs will be visible in the DevTools at all times.

Enabled by default, defautls are: last 100 logs with latency 500 milliseconds.

stateTab

Type: boolean. Enables state tab with state of all stores at each point in time. May cause performance issues in the large apps. Disabled by default.

devToolsConfig

Config for Redux DevTools, passed directly to the connect call. See the official docs.

Example of configurated call:

import { attachReduxDevTools } from "@effector/redux-devtools-adapter";

attachReduxDevTools({
  name: "My App",
  scope,
  trace: true,
});

In the Next.js - Pages Router

Read effector/next documentation

In the Next.js - App Router

Read effector/next documentation

Release process

FAQs

Package last updated on 02 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts