@samitouri / QOS-React-2 / commits / 800b874ed1

fix main

Forgot to update snapshots when addressing PR feedback.

Joe Savona committed Nov 13, 2023 at 13:14 UTC 800b874ed1841220e97737136a3a18b1a139eb31
1 file changed +4 -5
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/validate-no-set-state-in-render-uncalled-function-with-mutable-range-is-valid.expect.md
+4 -5
@@ -7,12 +7,12 @@ function Component(props) {
7 const logEvent = useLogging(props.appId);
8 const [currentStep, setCurrentStep] = useState(0);
9
10 + // onSubmit gets the same mutable range as `logEvent`, since that is called
11 + // later. however, our validation uses direct aliasing to track function
12 + // expressions which are invoked, and understands that this function isn't
13 + // called during render:
14 const onSubmit = (errorEvent) => {
11 - // 2. onSubmit inherits the mutable range of logEvent
15 logEvent(errorEvent);
13 - // 3. this call then triggers the ValidateNoSetStateInRender check incorrectly, even though
14 - // onSubmit is not called during render (although it _could_ be, if OtherComponent does so.
15 - // but we can't tell without x-file analysis)
16 setCurrentStep(1);
17 };
18
@@ -41,7 +41,6 @@ function Component(props) {
41
42 const onSubmit = (errorEvent) => {
43 logEvent(errorEvent);
44 -
44 setCurrentStep(1);
45 };
46 switch (currentStep) {