Skip to content

[Bug] New Context API does not work with ReactDOM.unstable_renderSubtreeIntoContainer #12493

Closed
@pmunin

Description

@pmunin

Do you want to request a feature or report a bug?
BUG

What is the current behavior?
Consumer rendered by invokes ReactDOM.unstable_renderSubtreeIntoContainer, invokes render function with DEFAULT context value ignoring value of Provider

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
Open example on Codesandbox.io

  1. Click "Increment state.contextValue"
    =>State should change to 1, and ChildComponent rendered directly will show it
  2. Click "Render into placeholder"
    => ChildComponent rendered through unstable_renderSubtreeIntoContainer should show 1

Actual result: ChildComponent rendered through unstable_renderSubtreeIntoContainer should show 111 (which is default value specified in createContext)

What is the expected behavior?
unstable_renderSubtreeIntoContainer should pass context through to consumer

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React: 16.3.0
Chrome: 65 x64
Windows: 10 x64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions