Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[react-test-renderer] Fix findByType broken for SimpleMemoComponent #17700

Closed
wants to merge 1 commit into from

Conversation

kevin940726
Copy link

Fix #17301 .

The fix is simply check if the tag of the fiber node is SimpleMemoComponent, and check the elementType instead of type.

I'm not fully understand the difference between elementType and type in test-renderer though, looks like if we changed to always get the elementType instead of type would also work? Maybe it has something to do with Lazy and Suspense, but AFAIK react-test-renderer currently doesn't support them.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 24, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 00c4d15:

Sandbox Source
goofy-noyce-tdid2 Configuration

@sizebot
Copy link

sizebot commented Dec 24, 2019

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against 00c4d15

@sizebot
Copy link

sizebot commented Dec 24, 2019

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against 00c4d15

@stale
Copy link

stale bot commented Mar 23, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Mar 23, 2020
@stale stale bot removed the Resolution: Stale Automatically closed due to inactivity label Mar 23, 2020
@gaearon
Copy link
Collaborator

gaearon commented Mar 23, 2020

This seems like it would break code searching by the inner type, right? I think we need a more fleshed out proposal for how you imagine this working ideally. You probably don't want different behavior for SimpleMemo and Memo. Overall, I think issues like this show that this whole API is flawed and not something we'd like to keep supporting in longer term. It exposes implementation details.

@bensampaio
Copy link

@gaearon what would be a better solution then?

Would it make sense to change the Flow types of React so that you can write findByType(MyComponent.type) without getting type errors? Or would you prefer that findByType accepts memo components as well like proposed in this MR?

@stale
Copy link

stale bot commented Jun 26, 2020

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jun 26, 2020
@stale
Copy link

stale bot commented Jul 6, 2020

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

@stale stale bot closed this Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Resolution: Stale Automatically closed due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

react-test-renderer: the findByType method doesn't work with memo components
5 participants