Conversation
|
|
||
| return _.reduce(state, (serializableState, substate, subStateKey) => { | ||
| const serializableSubState = transformSubstate(substate); | ||
| const transformedState = transformSubstate(state); |
There was a problem hiding this comment.
I think we should change things a bit differently. It seems to me like transformSubstate should be the entry point for serialization and the reducer logic should be placed into helper which tranformSubstate uses.
It seems to me like we are processing data twice in some cases.
There was a problem hiding this comment.
transformXY is just transforming state (array to object), nothing else. Serialization is recursive process until you reach ordinary value. And in that process, you need to transform something or sanitize it (sanitizeElement ...). I think naming is wrong. When I look now and before, I think this two process are better if they are divided.
MrBr
left a comment
There was a problem hiding this comment.
Looks good, good job with introducing traverse.
No description provided.