Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

getDataFromTree incorrectly handling React Context.Consumer #2553

@jsantha

Description

@jsantha

Intended outcome:

Walking down the tree via getDataFromTree correctly handles Context.Consumer and continue walking down the whole component tree.

Actual outcome:

getDataFromTree incorrectly handles Context.Consumer component and consider it as a Context.Provider. That means that render prop children function of Context.Consumer is not called but passed down to walkTree which is unable to handle plain function and consider tree to be traversed. (https://github.com/jsantha/getDataFromTreeReactContextBug/blob/master/getDataFromTreeDebug.ts#L156)

React version provided in demo reports corresponding warning: Warning: Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?

How to reproduce the issue:

Demo with debugged current version of getDataFromTree: https://github.com/jsantha/getDataFromTreeReactContextBug

Version

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions