mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Consider dispatch function from useActionState non-reactive (#29917)
Updated version of #29758 removing `useFormState` since that was the previous name for `useActionState`. --------- Co-authored-by: Hieu Do <hieudn.uh@gmail.com>
This commit is contained in:
+3
-7
@@ -10,8 +10,7 @@ import {
|
||||
ReactiveFunction,
|
||||
ReactiveInstruction,
|
||||
ReactiveScopeBlock,
|
||||
isDispatcherType,
|
||||
isSetStateType,
|
||||
isStableType,
|
||||
} from "../HIR";
|
||||
import { eachPatternOperand } from "../HIR/visitors";
|
||||
import { collectReactiveIdentifiers } from "./CollectReactiveIdentifiers";
|
||||
@@ -57,10 +56,7 @@ class Visitor extends ReactiveFunctionVisitor<ReactiveIdentifiers> {
|
||||
case "Destructure": {
|
||||
if (state.has(value.value.identifier.id)) {
|
||||
for (const lvalue of eachPatternOperand(value.lvalue.pattern)) {
|
||||
if (
|
||||
isSetStateType(lvalue.identifier) ||
|
||||
isDispatcherType(lvalue.identifier)
|
||||
) {
|
||||
if (isStableType(lvalue.identifier)) {
|
||||
continue;
|
||||
}
|
||||
state.add(lvalue.identifier.id);
|
||||
@@ -75,7 +71,7 @@ class Visitor extends ReactiveFunctionVisitor<ReactiveIdentifiers> {
|
||||
if (
|
||||
lvalue !== null &&
|
||||
state.has(value.object.identifier.id) &&
|
||||
!isSetStateType(lvalue.identifier)
|
||||
!isStableType(lvalue.identifier)
|
||||
) {
|
||||
state.add(lvalue.identifier.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user