You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand this is a feature request and questions should be posted in the Community Forum
I searched issues and couldn’t find anything (or linked relevant results below)
Problem
@uppy/status-bar currently uses lodash.throttle to import lodash's throttle function. However, lodash is deprecating individual packages like lodash.throttle in favor of directly using the lodash package ( https://lodash.com/per-method-packages ). lodash.throttle is also causing problems with Jest for some reason I still haven't been able to debug:
throttle would be undefined here when run with Jest. import * as throttle from 'lodash.throttle', import { throttle } from 'lodash', and const throttle = require('lodash.throttle') all works.
In our code, we ended up using yarn patch to move the dependency from lodash.throttle to lodash. It might be a good idea to do it here too.
Fixes: #4272
Co-authored-by: R <r@r.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
Initial checklist
Problem
@uppy/status-bar
currently useslodash.throttle
to import lodash'sthrottle
function. However, lodash is deprecating individual packages likelodash.throttle
in favor of directly using thelodash
package ( https://lodash.com/per-method-packages ).lodash.throttle
is also causing problems with Jest for some reason I still haven't been able to debug:https://github.com/transloadit/uppy/blob/main/packages/%40uppy/status-bar/src/Components.jsx#L3
throttle
would be undefined here when run with Jest.import * as throttle from 'lodash.throttle'
,import { throttle } from 'lodash'
, andconst throttle = require('lodash.throttle')
all works.In our code, we ended up using
yarn patch
to move the dependency fromlodash.throttle
tolodash
. It might be a good idea to do it here too.memoize-one
import is also causing problem with Jest ( https://github.com/transloadit/uppy/blob/main/packages/%40uppy/dashboard/src/Dashboard.jsx#L10 ), but we're not sure this is related. We similarly patch this usingyarn patch
in our codebase. These are the only two import statements that are causing problem with Jest in our codebase.Solution
Migrate from
lodash.throttle
tolodash
perhaps?Alternatives
Never upgrade to lodash v5 in the future?
Thank you for the great library!
The text was updated successfully, but these errors were encountered: