mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[hir] Update error message to say global
This is non ideal but at least it's a step in the right direction. Getting the correct error requires us to track every identifier and global, which seems a bit excessive for now. We can revisit and improve this error if this is starting to confuse folks.
This commit is contained in:
@@ -353,7 +353,7 @@ class InferenceState {
|
||||
effect = Effect.Mutate;
|
||||
} else {
|
||||
CompilerError.throwInvalidReact({
|
||||
reason: `This mutates a variable after it was passed to React, which means that React cannot observe changes to it`,
|
||||
reason: `This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it`,
|
||||
description:
|
||||
place.identifier.name !== null
|
||||
? `Found mutation of ${place.identifier.name}`
|
||||
@@ -370,7 +370,7 @@ class InferenceState {
|
||||
valueKind !== ValueKind.Context
|
||||
) {
|
||||
CompilerError.throwInvalidReact({
|
||||
reason: `This mutates a variable after it was passed to React, which means that React cannot observe changes to it`,
|
||||
reason: `This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it`,
|
||||
description:
|
||||
place.identifier.name !== null
|
||||
? `Found mutation of ${place.identifier.name}`
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (4:4)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (4:4)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (13:13)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (13:13)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (7:7)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (7:7)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ function Component(props) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (5:5)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ function Foo() {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (4:4)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (4:4)
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ function Foo() {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (4:4)
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it (4:4)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user