Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Support for sanitizing actions #51

@martinschayna

Description

@martinschayna

I would like to sanitize my actions before reporting them to Reactotron. With a little inspiration from Redux DevTools Extension I've done this with following code:

import Reactotron from "reactotron-react-js";
import { reactotronRedux } from "reactotron-redux";

const customReactotronRedux = pluginConfig => reactotron => {
  const original = reactotronRedux(pluginConfig)(reactotron);
  return {
    ...original,
    features: {
      ...original.features,
      reportReduxAction: (action, ms, important) => {
        original.features.reportReduxAction(actionSanitizer(action), ms, important);
      }
    }
  };
};

const reactotron = Reactotron.configure()
  .use(customReactotronRedux())
  .connect();

where actionSanitizer strips out some private data, normalizes action type/name etc. and overall makes action more readable for developers. Obviously, sanitized action cannot be dispatched back to the app and I satisfied with this. Everything works like a charm, so I think it would be nice to make it possible directly by passing sanitizer in plugin config. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions