Redux Toolkit configuration - adding a custom Type #29
-
If I createReduxMiddleware with defaultOptions, all of my Date fields are properly serified/deserified. When I try to create a custom Class and pass in customOptions as the documentation shows, Dates are not properly serified/deserified. const customOptions: SerifyOptions = { Any pointers on how I can fix this? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
My guess is that it has to do with your
Your Look at your As far as dates are concerned, my guess is the process simply failed before it got to them. Should have been an error, though. Was there not one? Note that with the Redux middleware involved, there are really two potential points of failure:
Depending on you Redux settings, a serialization failure may happen silently. So take a look at the values in your store and make sure they look as they should. |
Beta Was this translation helpful? Give feedback.
My guess is that it has to do with your
SatUnit
serifier function.structuredClone
creates a clone of the input value. If the input value were serializable, its clone would also be serializable and you wouldn't NEEDserify
.Your
serify
function should decomposeSatUnit
into a collection of serifiable types... meaning types that are ALREADY serializable, or other types represented in yourserify
options.Look at your
deserifier
function. What'svalue.Trigraph
? The assumption is thatserifier
put it there. IfTrigraph
isn't of a serifiable type, then you'll have to create another options entry to serify its type.As far as dates are concerned, my guess is the process simply failed before it…