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
{{ message }}
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
Currently when using "draft-js": "^0.10.1", I am getting a warning in my console that my server-side rendering of an Editor creates a different data-offset-key than my client-side rendering.
This issue is similar to that of the editor-key in Issue 385, which was resolved by adding a new prop, editorKey in PR 796
Looking at DraftEditorContents.react.js, the issue makes sense. A DraftOffsetKey is populated with the key that is retrieved from the block.
I believe these block's keys are populated by generateRandomKey(), but I am still digging. Before starting a PR, I want to get a better understanding of why these keys have to be random. Can we make their generation for server-side rendering yield the same values?
The text was updated successfully, but these errors were encountered:
Those are the block keys which are part of the editor state (more precisely, the content state). If you serialize the state when sending it down (https://draftjs.org/docs/api-reference-data-conversion.html) and render the client-side editor with the same keys then that should work.
If that doesn't work for you, I believe you should be able to create your own block keys manually in the state when creating the editor state.
I'm serializing the state to/from the database, but I'm still getting a data-offset-key mismatch between client and server. (exact same error as @hs737, using draft-js@0.10.2)
Any ideas why that could still be happening? Did you ever resolve your issue @hs737?
Currently when using
"draft-js": "^0.10.1"
, I am getting a warning in my console that my server-side rendering of anEditor
creates a differentdata-offset-key
than my client-side rendering.I am using react 15.3. Any way we can avoid this?
This issue is similar to that of the
editor-key
in Issue 385, which was resolved by adding a newprop
,editorKey
in PR 796Looking at
DraftEditorContents.react.js
, the issue makes sense. ADraftOffsetKey
is populated with thekey
that is retrieved from theblock
.I believe these
block
's keys are populated bygenerateRandomKey()
, but I am still digging. Before starting a PR, I want to get a better understanding of why these keys have to be random. Can we make their generation for server-side rendering yield the same values?The text was updated successfully, but these errors were encountered: