silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
167 stars 17 forks source link

Upgrade deps and remove lodash #1571

Closed axelboc closed 4 months ago

axelboc commented 4 months ago

Big batch of updates, in no particular order:

I noticed drei removed lodash from its codebase, and since this seems to be a trend, I'm doing the same. Turns out we've got alternatives for most of it, either in vanilla JS of course (e.g. typeof val === 'number' isn't that long to write after all...), or in other libs: MathUtils.clamp() in three, range() in d3-array, and useThrottledCallback in @react-hookz/web. When vanilla JS was a bit too verbose, I abstracted into my own utility functions (castArray and areSameDims).

This shaves off another 34 kB from the demo's bundle (in addition to the 50 kB saved in https://github.com/silx-kit/h5web/pull/1564). We should see an equivalent impact in consumer apps.