transloadit / uppy

The next open source file uploader for web browsers :dog:
https://uppy.io
MIT License
29.11k stars 2k forks source link

@uppy/react's new useUppyState breaking support for React 16/17? #4783

Closed skjelmo closed 11 months ago

skjelmo commented 11 months ago

Initial checklist

Link to runnable example

https://codesandbox.io/p/sandbox/stoic-easley-g6lstz

Steps to reproduce

Starting the sandbox should output:

ERROR in ./node_modules/@uppy/react/lib/useUppyState.js 5:9-29
export 'useSyncExternalStore' (imported as 'useSyncExternalStore') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version)

Sandbox is using DashboardModal from @uppy/react in app/components/Root/Root.js

I get the same locally when compiling with webpack.

Expected behavior

Expected @uppy/react to compile with react 16 since it is a peerDependency.

Seems to fail because useSyncExternalStore imported by useUppyState.js is not available before react 18.

Actual behavior

Compilation fails.

arturi commented 11 months ago

Hi, thank you for reporting. We are looking into this, will probably revert the change for now and issue a patch release. Apologies for the inconvenience.