jpuri / react-draft-wysiwyg

A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
MIT License
6.41k stars 1.16k forks source link

Warning: Can't call setState #951

Open sirvival3 opened 4 years ago

sirvival3 commented 4 years ago

When I click on the editor I get this warning in the console:

Warning: Can't call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to this.state directly or define a state = {}; class property with the desired state in the r component.

I made a codeSandbox where it is too: https://codesandbox.io/s/brave-architecture-4zpm5

sirvival3 commented 4 years ago

Its only in StrictMode I get the warning: https://codesandbox.io/s/strange-monad-lxtuu?file=/src/index.js

sahildhiman commented 4 years ago

@sirvival3 did you find the solution of this issue. I am getting same problem?

megarg commented 4 years ago

Is there any solution to this? I am getting the same error.

kitman20022002 commented 4 years ago

Me too

juicyjelly74 commented 3 years ago

Same error

Salalf01 commented 3 years ago

Any news about this warning?

yusuf-khamis commented 3 years ago

This issue still persists, and there is a PR pending to be merged which i believe fixed the issue, can the owner kindly review and merge the PR

appadminlx commented 2 years ago

@jpuri is there any chance we can have PR merged which fixes the issue?

Jrgsto commented 2 years ago

Any news?

BaniGrisson commented 2 years ago

Is this thing abandoned?

bubbster95 commented 2 years ago

Literally checked so many boards all the same desperate cries for help. #mergethedangfix

siddjain commented 2 years ago

I would like to understand why does this warning not appear in some demos? E.g., the demo at https://jpuri.github.io/react-draft-wysiwyg/#/ does not give the warning.

stormdotcom commented 2 years ago

any fix?

BaniGrisson commented 2 years ago

For me its not the error itself. It's knowing that there is a solution ready but apparently noone paying attention to mantaining this package. I'll just use CKE.

maxlech974 commented 2 years ago

hmmm still have this issue, I use Next.js and I try to disable reactStrictMod, but no result... :s

taimoorimran commented 2 years ago

Guys any fix yet? -_-

sabbirshawon commented 2 years ago

I got the same error

image

Yidi0213 commented 2 years ago

also got the same error

owen-soak commented 2 years ago

@jpuri Any word on if the possible fix https://github.com/jpuri/react-draft-wysiwyg/pull/1044 could be merged? Thanks in advance.

tylertaewook commented 2 years ago

@jpuri any fixes yet??

xeqtrTC commented 2 years ago

Still same error.

kiknaio commented 2 years ago

Still no fixes I see :|

keithics commented 2 years ago

We replaced it with React Quill instead because of this issue.

angelinuxx commented 1 year ago

Still same error.

ggenilson commented 1 year ago

Still same error!

alexeysarakuz commented 1 year ago

The same... 😢😢😢

berryboylb commented 1 year ago

Doesn't anyone care about this package i'm getting the same error

PixiLoop commented 1 year ago

i'm also facing the same problem

SelmiAbderrahim commented 1 year ago

Somehow worked by Just removing "StrictMode" from my app.

cheezballs commented 1 year ago

Ok, so is this project dead or what? Ignoring this bug for 2 years is insane. "just remove strict mode" is not a solution. Definitely not a prod-ready lib anymore.

EricHasegawa commented 1 year ago

Almost three years later - having the same issue lol

mszula commented 1 year ago

Haha, I got exactly the same right now 😂 Is there any plans to fix this bug? "remove strict mode" is definitely not a solution. We're serious men and we doing serious software 😄

ilhamksyuriadi commented 1 year ago

any update for this? still got the same error

EricHasegawa commented 1 year ago

@ilhamksyuriadi and anyone else who ends up here - if you look at this issue here it seems like this package has a sole maintainer who has a lot on their plate. I wouldn't count on a fix anytime soon :(

quocbahuynh commented 1 year ago

any solution? I have same problem with Next JS

tonikny commented 1 year ago

One more with the same problem on Next.js :disappointed:

quocbahuynh commented 1 year ago

Do you have other libraries?

ilhamksyuriadi commented 1 year ago

@EricHasegawa for my case, I already moved to react quill

Grindhead commented 1 year ago

same over here

Mark-LohseMiranda commented 1 year ago

We replaced it with React Quill instead because of this issue.

Thanks for this...so much easier

IbrahimO123 commented 1 year ago

Use React Quill instead

web-2017 commented 1 year ago

Try this, should work

import { Editor } from 'react-draft-wysiwyg' 
import { EditorState } from 'draft-js'
const [editorState, setEditorState] = useState(EditorState.createEmpty())
const [isMounted, setIsMounted] = useState(false)
useEffect(() => {
    setIsMounted(true)
       return () => {
        setIsMounted(false)
    }
}, [])

<div  className="order_detail">
        {isMounted && (
            <Editor
                editorState={editorState}
                wrapperClassName="editor"
                editorClassName="demo-editor"
                onEditorStateChange={setEditorState}
                onChange={handleChange}
            />
        )}
    </div>`
mvshvets commented 10 months ago

Попробуйте это, должно сработать

import { Editor } from 'react-draft-wysiwyg' 
import { EditorState } from 'draft-js'
const [editorState, setEditorState] = useState(EditorState.createEmpty())
const [isMounted, setIsMounted] = useState(false)
useEffect(() => {
    setIsMounted(true)
       return () => {
        setIsMounted(false)
    }
}, [])

<div  className="order_detail">
        {isMounted && (
            <Editor
                editorState={editorState}
                wrapperClassName="editor"
                editorClassName="demo-editor"
                onEditorStateChange={setEditorState}
                onChange={handleChange}
            />
        )}
    </div>`

It didn't work for me

devsomda commented 7 months ago

Still same 🥲🥲

jhoberterato commented 6 months ago

it's now 2024 but still a problem

Clarence161095 commented 6 months ago

Thank you, This is my needed

rangga-synergy commented 6 months ago

this error is annoying.

hossein-ahmadi-021 commented 5 months ago

Please don't write a package if you can't support it :)

cheezballs commented 5 months ago

What an absolute joke of a project. People BEGGING you to merge PRs to fix SIMPLE bugs which you ignore. You'd be better off deleting this than keeping it around for your resume.

bienvenuushindi commented 5 months ago

Switching to React Quill because of this issue