draft-js icon indicating copy to clipboard operation
draft-js copied to clipboard

Upgrade Immutable to 3.8.1

Open djforth opened this issue 9 years ago • 32 comments

Do you want to request a feature or report a bug? Feature

What is the current behavior? Current versions of Draft use Immutable 2.7.4

What is the expected behavior? Would be useful to upgrade to latest version (3.8.1) to reduce dependancy mismatch (Working on project that needs 3.8.1, which means I need 2 versions of immutable). Also is worth setting Immutable as a peer dependancy rather than a dependancy so people are aware if there is a mismatch.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Had a quick look and 0.91, 0.10-stable & 0.10-alpha all depend on 2.7.4

djforth avatar Jan 17 '17 08:01 djforth

Completely agree, would be nice to have such an update of the dependencies. Plus, the #607 is still open, and this can cause some serious problems on some browsers.

Bleeky avatar Jan 29 '17 18:01 Bleeky

I did have a quick look at upgrading it fork, but looks like it isn't a trivial task. Would be happy to have a go if the maintainers think it would be a useful thing?

djforth avatar Feb 04 '17 10:02 djforth

Related to #879

quicksnap avatar Feb 15 '17 00:02 quicksnap

Could we declare Immutable as a ^ version rather than ~ so that we can be on any later minor version rather than a specific one? This would allow us to upgrade minor versions in our apps without having to get a new version of draft-js every time.

chrisui avatar May 08 '17 17:05 chrisui

This would be great! If anyone wants to work on it, we'll make time to review the PR.

flarnie avatar Jun 15 '17 22:06 flarnie

Hey folks, any updates on this one? I found this issue as a performance critical. The logging message appears on each user typing, thus is slowing performance significantly.

RomanLysogor avatar Jul 13 '17 05:07 RomanLysogor

Seconded that an update on this would be helpful. The logging messages are really detrimental.

mc-funk avatar Aug 25 '17 20:08 mc-funk

Hi there, I just discovered that my bundled code contains two copies of immutable because of draft-js' old version dependency. We are using [email protected] in our code, [email protected] is [email protected].

There are fixes for immutable Records between these two versions that we assert in tests in our code and that which would improve performance of draft-js as a whole.

octatone avatar Sep 15 '17 10:09 octatone

Hi, wanted to see if there are any plans on doing this? As others have said, the console.warn is on every input changed and causes serious slowdown.

shakdoesgithub avatar Nov 03 '17 02:11 shakdoesgithub

Hi @shakdoesgithub ,

There is an open PR for bumping to immutable 4 on https://github.com/facebook/draft-js/pull/1439 however if you would like to work on the meantime to bump to 3.8.1 that would be awesome as well

mitermayer avatar Nov 03 '17 04:11 mitermayer

As previously mentioned, if you're running into this issue with the hundreds of console.warn and the serious degrade in performance because of it. One simple fix is to fork draft-js and include the fork into your project. I have a fork of draft js with version 3.8.1 of Immutable, that anyone can use if they like until an updated version of Immutable is added to draft-js.

CarsonYong avatar Nov 29 '17 20:11 CarsonYong

@CarsonYong Perhaps I'm missing some context here, but would it be worth it to try submitting your bump as a pull request?

mc-funk avatar Nov 29 '17 20:11 mc-funk

The work was enormous, but somehow I managed to pull it through ;) https://github.com/facebook/draft-js/pull/1573

Edit: Oh, crap, it's failing flow type check. I'll take back everything I said.

TomiS avatar Dec 13 '17 09:12 TomiS

@TomiS we're all rooting for you!

mc-funk avatar Dec 13 '17 14:12 mc-funk

@TomiS is there any update on this? I'm getting loads of warning messages using Immutable via DraftJS.

pfarnach avatar Jan 10 '18 23:01 pfarnach

Not really much to say. There are ~20 flow errors to solve after updating immutable to 3.8.x. Some of them seem quite simple but there is one problematic:

Error: node_modules/immutable/dist/immutable.js.flow:406
406:   static of<T>(...values: T[]): SetSeq<T>;
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type. This type is incompatible with
387:   static of<T>(...values: T[]): IndexedSeq<T>;
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type
  This parameter is incompatible:
    406:   static of<T>(...values: T[]): SetSeq<T>;
                                         ^^^^^^^^^ SetSeq. This type is incompatible with
    387:   static of<T>(...values: T[]): IndexedSeq<T>;
                                         ^^^^^^^^^^^^^ IndexedSeq

It looks like an internal type error in immutable.js that probably cannot be fixed outside that lib. I can get rid of that error by setting .*/node_modules/immutable/dist/immutable.js.flow in the ignore section of .flowconfig but all the other errors also disappear which is probably not cool.

TomiS avatar Jan 11 '18 16:01 TomiS

Ah seems annoying. I have zero experience with flow, otherwise I'd lend a hand. Are there any maintainers (@flarnie) that could jump in to help?

pfarnach avatar Jan 11 '18 17:01 pfarnach

Did this ever get fixed? I'm getting flooded by these messages making it hard to see relevant logs. Feels like a DDOS attack on my console.

betancourtl avatar Feb 12 '18 00:02 betancourtl

Did this ever get fixed?

hxgdzyuyi avatar Feb 22 '18 11:02 hxgdzyuyi

If you add your own dependency for a newer version of Immutable the errors should go away. I have this in my dependencies:

"immutable": "^3.8.2",

ddelrio1986 avatar Feb 22 '18 15:02 ddelrio1986