[drag-n-drop-plugin] store.getReadOnly is not a function
See original GitHub issueWe have an editor built with the draft-js-drag-n-drop-plugin
and our error monitoring service is reporting a constant stream of this error:
Looking at the drag-n-drop-plugin, this is happening because store.getReadOnly
is first defined as undefined
, and only assigned a proper function in initialize
:
Looking at createDecorator.js
, it calls store.getReadOnly
in the render
method but that is throwing an error for some of our users:
So for some reason render
is called here before initialize
of the main plugin is called. How can that happen? I can submit a patch to introduce a check to createDecorator
(store && store.getReadOnly
), but is that the right fix or is there something bigger going on?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
React Plugin Architecture for Draft.js including Slack-Like ...
Any suggestions on how to get this to work? I even tried storing separate instances of mentionPlugin for each instance of editorState in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone else that runs into this problem, I was creating the plugins in the render function. When I added an image to my editor I was updating the state which caused the editor to rerender and the plugins to be recreated.
I fixed this by creating the plugins in the constructor of my component instead.
To help Google index this, the error was coming from the
createDecorators
function 😃.reopen if needed