Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
reductive-dev-tools
Advanced tools
reductive and reason-react reducer component integration with Redux DevTools
reductive and reason-react reducer component integration with redux-devtools-extension
via npm:
npm install --save-dev reductive-dev-tools
then add reductive-dev-tools
to your "bs-dependencies" inside bsconfig.json
.
Peer depedencies
reason-react, reductive, redux-devtools-extension, redux (redux-devtools-extension's peer dep.) should be also installed.
-bs-g
into "bsc-flags"
of your bsconfig.json to have variant and record field names available inside extension.SomeAction(unit)
to SomeAction
) since plain varaints do no carry debug metedata with them (represented as numbers in js)feature | reductive | react hooks useReducer |
---|---|---|
pause | ✔ | ✔ |
lock | redux-devtools-extension/#618 | redux-devtools-extension/#618 |
persist | ✔ | ✔ |
export | ✔ | ✔ |
import | ✔ | ✔ |
jump | ✔ | ✔ |
skip | ✔ | ✔ |
sweep | redux-devtools-extension/#618 | redux-devtools-extension/#618 |
reorder | redux-devtools-extension/#618 | redux-devtools-extension/#618 |
dispatch | ✔ | ✔ |
test | REDUX ONLY | REDUX ONLY |
trace | REDUX ONLY | REDUX ONLY |
Utilize provided store enhancer ReductiveDevTools.Connectors.reductiveEnhancer
let storeEnhancer =
ReductiveDevTools.(
Connectors.reductiveEnhancer(
Extension.enhancerOptions(~name="MyApp", ()),
)
);
let storeCreator = storeEnhancer @@ Reductive.Store.create;
Replace React.useReducer
with ReductiveDevTools.Connectors.useReducer
and pass options with unique component id as name.
let (state, send) = ReductiveDevTools.Connectors.useReducer(
ReductiveDevTools.Extension.enhancerOptions(~name="MyComponent", ()),
reducer,
yourInitialState);
No longer supported. Please install latest from 0.x:
npm install --save-dev reductive-dev-tools@0.2.6
And refer to old documentation.
ReductiveDevTools.Extension.enhancerOptions(
/* the instance name to be showed on the monitor page */
~name="SomeTest",
/* action creators functions to be available in the Dispatcher. */
~actionCreators=Js.Dict.fromList([
("increment", (.) => CounterAction(Increment)),
("decrement", (.) => CounterAction(Decrement)),
("complexAppend", ((first, last) => StringAction(ComplexAppend(first, last))) |> Obj.magic)
]),
/* if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once */
~latency=500,
/* maximum allowed actions to be stored in the history tree. */
~maxAge=50,
/* actions types to be hidden / shown in the monitors (while passed to the reducers), If `actionsWhitelist` specified, `actionsBlacklist` is ignored. */
~actionsBlacklist=[|"StringAction"|],
/* actions types to be hidden / shown in the monitors (while passed to the reducers), If `actionsWhitelist` specified, `actionsBlacklist` is ignored. */
~actionsWhitelist=[|"CounterAction"|],
/* if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched. */
~shouldCatchErrors=false,
/* If you want to restrict the extension, specify the features you allow. */
~features=ReductiveDevTools.Extension.enhancerFeatures(
~pause=true,
~persist=true,
~export=true,
~import=Obj.magic("custom"),
~jump=true,
~dispatch=true,
()),
())
You can also manually customize serialized objects keys and action names displayed inside extension. Two common usecases:
Labeling variants with constructors.
type routerActions = [
| `RouterLocationChanged(list(string), string, string)
];
open ReductiveDevTools.Utilities;
Reductive.Store.dispatch(store,
`RouterLocationChanged(url.path, url.hash, url.search)
|. labelVariant([|"path", "hash", "search"|]));
Labeling record keys for records inside variants (since Records inside variants do not carry debug metadata in bucklescript yet).
type url = {
path: list(string),
hash: string,
search: string,
};
type routerActions = [
| `RouterLocationChanged(url)
];
open ReductiveDevTools.Utilities;
Reductive.Store.dispatch(store,
`RouterLocationChanged(url
|. tagRecord([|"path", "hash", "search"|]));
This can also be used to override bucklescript debug metadata(if really needed). Definitions are at: utilities.rei
Current implementation depends on internal bucklescript representation of debug metadata and variants in js. Changes to it in future may silently break the extension.
FAQs
reductive and reason-react reducer component integration with Redux DevTools
The npm package reductive-dev-tools receives a total of 20 weekly downloads. As such, reductive-dev-tools popularity was classified as not popular.
We found that reductive-dev-tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.