object.assign changes props ordering and resulting in different attribute orders on the server and client
lalau opened this issue · 5 comments
I am tracing a checksum mismatch warning and noticed the props' key ordering is changed here:
react-i13n/src/utils/createI13nNode.js
Lines 54 to 59 in 2a7b3b8
I only see the issue happening in chrome and on certain executions of that object assign code. Technically the key ordering is not something we should rely on because it's unspecified according to the spec, but it seems that's what react is using to render the attribute when using the spread operator. Should we play it safe here to not use object.assign but a for in loop to preserve the original ordering?
A for in
loop does not guarantee order preservation either.
That's true, but at least that's the de-facto standard of browsers to preserve insertion order, while object.assign seems more unpredictable. That's what I mean to play it safe. There isn't really a fix here except fixing the spread operator.
Hi @lalau thanks for reporting this, may I know which version of react-i13n
and chrome
that you are using?
@lalau is this still an issue?
No