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
dive() throws TypeError: ShallowWrapper::dive() can only be called on components when diving into component wrapped with Context Provider/Consumer and React.memo.
Started to work as expected when isMemo(type) was added to condition in ReactSixteenAdapter.js::isCustomComponent. Not sure if this is a right change so no PR yet.
Expected behavior
dive() dives into deepest components just as it does when React.memo is not used:
shallow(React.createElement(()=><App/>)).dive()// works, is ContextConsumershallow(React.createElement(()=><App/>)).dive().dive()// works, is App's divshallow(React.createElement(()=><App/>)).dive().dive().dive()// throws, should throwshallow(React.createElement(()=><AppMemoized/>)).dive()// throws, should be ContextConsumer
Looks like this is specific to memo, and doesn't have anything to do with createContext. Fix coming shortly.
- [new] support `suspenseFallback` option; support `Suspense`/`Lazy` (#1975)
- [fix] `shallow`: properly dive through `memo` components (#2103, #2068)
- [fix] avoid a Context.Provider deprecation warning
- [fix] shallow renderer for `memo` does not respect `defaultProps` (#2115)
- [fix] Don’t show wrapped component displayName in lazy component (#1975)
- [fix] `simulateEvent`: call the adapter’s implementation, not the raw one (#2100)
- [deps] update `enzyme-adapter-utils`
- [dev deps] update `eslint-plugin-react`, `eslint-plugin-import`
Current behavior
dive()
throwsTypeError: ShallowWrapper::dive() can only be called on components
when diving into component wrapped with ContextProvider
/Consumer
andReact.memo
.Started to work as expected when
isMemo(type)
was added to condition inReactSixteenAdapter.js::isCustomComponent
. Not sure if this is a right change so no PR yet.Expected behavior
dive()
dives into deepest components just as it does whenReact.memo
is not used:Example
Your environment
API
Version
Adapter
The text was updated successfully, but these errors were encountered: