Lee Borsboom lee-borsboom Queensland, Australia

lee-borsboom/jsonrpc 3

JSONRPC 2.0 package for Laravel 4

lee-borsboom/shmock 0

Simple HTTP Mocking Library

PR opened ericnograles/browser-image-resizer

fix: scale the image even when autoRotate is false

Fixes ericnograles/browser-image-resizer/issues#22

+8 -2

0 comment

3 changed files

pr created time in 2 months

issue openedfacebook/react

Bug: Context value change results in rendering of components that do not consume said context

Given the following structure:

<MyContext.Provider value={value}>
    <C />

A and B will be re-rendered when the context value changes because C is consuming it. This appears to be unnecessary as preventing A (and thus B) from re-rendering still results in changes from C being reflected in the DOM.

This is obviously a performance issue, particularly when the context value changes frequently due to user interaction (in my case, on keystroke of a text field).

This seems like the sort of thing that could very well be intentional and I'm missing some use cases that necessitate this behaviour, but from my sample code and in a complex real-world scenario, short-circuiting the render of A when only "children" change seems to work and with a lot less renders.

React version: Noticed in 16.8.3, confirmed the same behaviour in 16.13.1

Steps To Reproduce

Code example:

The current behavior

Components that do not consume the context value directly are re-rendered due to a change in context value

The expected behavior

Only direct consumers of the context value are re-rendered due to a change in context value

created time in 3 months