What kind of issue is this?
Link to repro
https://playground.react.dev/#N4Igzg9grgTgxgUxALhASwLYAcIwC4AEwBcMCAhnggMIQB2VAHngDQFRgIBKCAZmxxr0mhAL4FeMCBgIAdEGXJw88gNyy6GuPTCFaUBghg9etQ8wIBeEoqpmRACgCU6zXW11dBAGIQIVgmcrAD4iDQISHUJtAypjPgDBewRmB31DeNNhFLwXDXCCMjxYOkCCiIAeACMoPDx6coiCemoAGzQ4AGtLYCDLUOBGpoI0XkCYjJMnSNijEwA6OFgyBgIAamsARldhiNFRRuChggBBABMzxoqAehq6+iPSgjy6UVcNFJx8SM9CE6wsAE+gMCtdrgQAMoAC3IZDObAwtXIVVaCAIdHoAFoAKoASQIADdyK0oAhQeCIfU4SNSuRCgl6gRyASIGgzgQ8DA0ABzblGemYlZnIxoOjcggAdyhCFKeGlhOJpJIMLFCDABQ8XgmcRMiU4JgcAAYXgUiiUyk9KukdXxksx5gAFKQEtn8okkhA9bVzPiiR67AgVXz+a7+3ZBvwEUPHCMhsOVa7Wn1Zcx4R3O10wMMvN4aECiIA
Repro steps
Sometimes you need a shared, mutable value that isn’t tied to the UI but is used across multiple components. In these cases, you don’t want React to trigger re-renders when the value changes. To handle this, you can store the value in a ref and pass it down through context.
However, when a child component mutates this value (for example, inside an event handler), the compiler currently produces an error and causes optimizations to be skipped. I feel this is too restricted for what is otherwise a legitimate React pattern.
How often does this bug happen?
Every time
What version of React are you using?
19.1.0
What version of React Compiler are you using?
19.1.0-rc.1
What kind of issue is this?
Link to repro
https://playground.react.dev/#N4Igzg9grgTgxgUxALhASwLYAcIwC4AEwBcMCAhnggMIQB2VAHngDQFRgIBKCAZmxxr0mhAL4FeMCBgIAdEGXJw88gNyy6GuPTCFaUBghg9etQ8wIBeEoqpmRACgCU6zXW11dBAGIQIVgmcrAD4iDQISHUJtAypjPgDBewRmB31DeNNhFLwXDXCCMjxYOkCCiIAeACMoPDx6coiCemoAGzQ4AGtLYCDLUOBGpoI0XkCYjJMnSNijEwA6OFgyBgIAamsARldhiNFRRuChggBBABMzxoqAehq6+iPSgjy6UVcNFJx8SM9CE6wsAE+gMCtdrgQAMoAC3IZDObAwtXIVVaCAIdHoAFoAKoASQIADdyK0oAhQeCIfU4SNSuRCgl6gRyASIGgzgQ8DA0ABzblGemYlZnIxoOjcggAdyhCFKeGlhOJpJIMLFCDABQ8XgmcRMiU4JgcAAYXgUiiUyk9KukdXxksx5gAFKQEtn8okkhA9bVzPiiR67AgVXz+a7+3ZBvwEUPHCMhsOVa7Wn1Zcx4R3O10wMMvN4aECiIA
Repro steps
Sometimes you need a shared, mutable value that isn’t tied to the UI but is used across multiple components. In these cases, you don’t want React to trigger re-renders when the value changes. To handle this, you can store the value in a ref and pass it down through context.
However, when a child component mutates this value (for example, inside an event handler), the compiler currently produces an error and causes optimizations to be skipped. I feel this is too restricted for what is otherwise a legitimate React pattern.
How often does this bug happen?
Every time
What version of React are you using?
19.1.0
What version of React Compiler are you using?
19.1.0-rc.1