React-data-grid: Immutable.js dependency

Created on 2 Oct 2015  路  7Comments  路  Source: adazzle/react-data-grid

This project relies on Immutable being globally available. Are there any plans on adding it as a dependency so you don't have to attach Immutable to window or global? Specifically these checks are causing problems:

typeof Immutable !== 'undefined'

Thanks!

tooling

Most helpful comment

I created a blank app using the latest create-react-app, and imported react-data-grid. It throws error:

./node_modules/react-data-grid/dist/react-data-grid.js
Module not found: Can't resolve 'immutable' in 'C:\Documents\Workspace\table\node_modules\react-data-grid\dist'

I manually installed immutable.js in my project and this error disappeared.

Wonder if it is a bug. Don't want to create a new issue so I post it here.

All 7 comments

Hi,
we used the above check as we wanted the grid to have the ability to use use immutable data without having Immutable.js as a packaged dependency. If Immuable is not defined on window, then the grid should assume that normal js arrays are used for rows and columns.

Perhaps we could extract the immutable functionality to a separate file for those who do not require it

What sort of issue is this causing exactly? It should not cause a script error.

Sorry let me clarify the issue. To be able to use Immutable in react-data-grid you need to have Immutable defined on global or window. How would you guys feel about making it a configuration option you pass to the grid? Or what if we detected that the array passed in for columns and rows was a immutable List?

sure - understood
Think the key we were aiming for is that the likely case is either:

  • you use immutable, so already ship this, so don't want us shipping another copy
  • you don't use immutable, and don't want to use it in the grid, so don't want to take the extra few kb

having that as a config option sounds a nice idea, though not sure how that works from a webpack point of view?

We discussed maybe adding a 3rd use case to the above:

  • you want immutable in the grid, but not global
    as far as we could see, that is either a custom build that we publish, similar to having react-data-grid and react-data-grid-with-addons we'd have a 3rd file which bundled immutable.js?

I created a blank app using the latest create-react-app, and imported react-data-grid. It throws error:

./node_modules/react-data-grid/dist/react-data-grid.js
Module not found: Can't resolve 'immutable' in 'C:\Documents\Workspace\table\node_modules\react-data-grid\dist'

I manually installed immutable.js in my project and this error disappeared.

Wonder if it is a bug. Don't want to create a new issue so I post it here.

Upgraded from 4.0.8 to 6.0.1 (even tried 5.0.4) and seeing the same dependency issue.

I am seeing the same issue with react-data-grid-addons 5.0.5.

The same for me upgrading to 5.0.4

Was this page helpful?
0 / 5 - 0 ratings