Closed mhuynh5757 closed 1 year ago
Non-serializable values such as error objects should not be put into actions and state as per the Redux team's guidelines. Right now, if an error occurs, the Redux Toolkit middlewares will extensively warn about the error object.
Non-serializable values such as error objects should not be put into actions and state as per the Redux team's guidelines. Right now, if an error occurs, the Redux Toolkit middlewares will extensively warn about the error object.
This is not obvious in the code. How do we make sure anyone modifying our code knows this and does not forget?
It's a "Best Practice" according to the Redux docs, see here: https://redux.js.org/style-guide/#do-not-put-non-serializable-values-in-state-or-actions
Should we make a reference to these docs in our source code somewhere? Not sure what the best solution is.
It's a "Best Practice" according to the Redux docs, see here: https://redux.js.org/style-guide/#do-not-put-non-serializable-values-in-state-or-actions
Should we make a reference to these docs in our source code somewhere? Not sure what the best solution is.
A comment in the code that has a link to the best practice is better. Readme works too. Since you're doing this in multiple places in the code, is it possible to create a helper/util function that does this that way you can add that comment in a single location?
Submission Checklist
CHANGELOG.md
reflects any feature, bug fixes, or known issues made in the source code~Files changed
tab was made prior to submitting the pull request ensuring the style guide was followedDescription
This PR serializes errors using the
miniSerializeError
function provided by Redux Toolkit. Please note that user actions are not done in this PR, as there is further refactoring work needed as part of VBLOCKS-1834.Breakdown
miniSerializeError
on errors before putting them in actions or app state.Validation
Additional Notes
Further work will be done to bring user actions up to the same standard.
Contributing to Twilio