Skip to content

feat(store-devtools): add actionCreators config option#5194

Open
Arul1998 wants to merge 1 commit into
ngrx:mainfrom
Arul1998:feat/store-devtools-action-creators
Open

feat(store-devtools): add actionCreators config option#5194
Arul1998 wants to merge 1 commit into
ngrx:mainfrom
Arul1998:feat/store-devtools-action-creators

Conversation

@Arul1998

Copy link
Copy Markdown

Allow action creators to be passed to the Redux DevTools extension so actions can be dispatched manually from the extension's dispatcher.

Closes #4038

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

There is no way to make action creators available in the Redux DevTools extension's dispatcher. Dispatching an action manually from the extension requires writing the action as a JSON string by hand each time, which is tedious and error-prone.

Closes #4038

What is the new behavior?

StoreDevtoolsConfig accepts a new optional actionCreators option (an array or object of action creators, e.g. created with createAction). It is passed through to the Redux DevTools extension's connect/send options, so the extension's dispatcher lists the app's actions and they can be dispatched manually from the DevTools UI.

const bookRented = createAction('[Books] Rent', props<{ id: number }>());
const bookReturned = createAction('[Books] Return', props<{ id: number }>());

provideStoreDevtools({
  actionCreators: [bookRented, bookReturned],
});

The option was requested in #4038 and corresponds to the extension's actionCreators argument.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

The option is optional and is omitted from the extension config when not provided, so existing setups are unaffected.

Other information

The feature was greenlit by @timdeschryver in the issue thread. Docs added to the store-devtools instrumentation options guide.

Allow action creators to be passed to the Redux DevTools extension so actions can be dispatched manually from the extension's dispatcher.

Closes ngrx#4038
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add actionCreators to StoreDevToolsOptions

1 participant