question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error diving through react-redux connected components

See original GitHub issue

Current behavior

I get a ShallowWrapper::dive() can only be called on components error when trying to .dive() through a component wrapped in react-redux’s connect function.

See demo at https://codesandbox.io/s/v33j14k0jl

Expected behavior

I should be able to dive through connected components and shallow render the component’s contents. I know this worked as of react-redux 5.1.1. They have transitioned to the new the new React Context API since. If this belongs as an issue in the react-redux repo, I’ll recreate it there.

Your environment

Running demo on CodeSandbox

I appreciate the recent work to get the new Context APIs working and they have worked for every other dependency I’ve upgraded in our React Native app (react-i18next was a crucial one). However something seems different with react-redux. They could have a different/unique implementation. Thanks for looking into this 😃

API

  • shallow
  • mount
  • render

Version

library version
enzyme 3.9.0
react 16.6.6
react-dom 16.8.6
react-test-renderer Not explicitly installed
adapter (below) 1.12.1

Adapter

  • enzyme-adapter-react-16
  • enzyme-adapter-react-16.3
  • enzyme-adapter-react-16.2
  • enzyme-adapter-react-16.1
  • enzyme-adapter-react-15
  • enzyme-adapter-react-15.4
  • enzyme-adapter-react-14
  • enzyme-adapter-react-13
  • enzyme-adapter-react-helper
  • others ( )

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
atsikovcommented, Jun 20, 2019

Still something is wrong with react-redux. I suppose it is partially about useMemo as connect with { pure: false }, .text() produces different output.

https://codesandbox.io/s/old-currying-4lme5

Will create new issue as soon as figure out some more particular test case.

1reaction
OzzieOrcacommented, Apr 23, 2019

Ah ok. That makes sense. I saw the adapter releases go out afterwards and guess I assumed the code changes were only in the adaptors. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error diving through react-redux connected components #2106
I should be able to dive through connected components and shallow render the component's contents. I know this worked as of react-redux 5.1.1...
Read more >
Developers - Error diving through react-redux connected components -
I get a ShallowWrapper::dive() can only be called on components error when trying to .dive() through a component wrapped in react-redux 's connect...
Read more >
Error in testing react/redux connected components using ...
In case anyone has a similar issue, here is what has worked for me: // test-utils.js import React from "react"; import { render...
Read more >
How to deal with failure in Redux connect - Medium
We proposed a solution based on an intermediary EitherComponent component that can fallback if we pass empty values.
Read more >
React Redux connect(): When and how to use it
Cover when and how to use the React Redux connect() API to create container components that are connected to the Redux state.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found