You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of the createSlice by default creates an actionCreator with the signature for a single parameter.
In our application we are using the meta pretty much on every single action and sometimes the error properties of the flux standard actions as well.
And while redux toolkit has been great to reduce boilerplate, having to override the action with prepare for every single case kind of fails this purpose.
Is there a way we could add an extra property to the slice configuration where we could define the default signature for that slice generated action creators?
I was thinking something like this:
// An ordered array with name of params.
const defaultActionCreator = ['payload', 'meta', 'error'];
// An ordered array of tuples with name and default value of param.
const defaultActionCreator = [['payload', {}], ['meta', {}], ['error', false]]
And in the implementation would be something like this:
The current implementation of the createSlice by default creates an actionCreator with the signature for a single parameter.
In our application we are using the meta pretty much on every single action and sometimes the error properties of the flux standard actions as well.
And while redux toolkit has been great to reduce boilerplate, having to override the action with prepare for every single case kind of fails this purpose.
Is there a way we could add an extra property to the slice configuration where we could define the default signature for that slice generated action creators?
I was thinking something like this:
And in the implementation would be something like this:
Then the signature of the 'getAll' actionCreator would end up like this.
The text was updated successfully, but these errors were encountered: