[compiler] Don't throw calculate in render when there is a ref in the effect

This commit is contained in:
Jorge Cabiedes Acosta
2025-09-22 14:50:05 -07:00
parent 0f1e058c43
commit eb87f344d8
@@ -18,6 +18,7 @@ import {
CallExpression,
Instruction,
isUseStateType,
isUseRefType,
} from '../HIR';
import {eachInstructionLValue, eachInstructionOperand} from '../HIR/visitors';
import {isMutable} from '../ReactiveScopes/InferReactiveScopeVariables';
@@ -284,6 +285,11 @@ function validateEffect(
}
for (const instr of block.instructions) {
// Early return if any instruction is deriving a value from a ref
if (isUseRefType(instr.lvalue.identifier)) {
return;
}
if (
instr.value.kind === 'CallExpression' &&
isSetStateType(instr.value.callee.identifier) &&