Skip to content

Conversation

@CiaranMn
Copy link
Member

Updates the Hazel livelit wrapper to also report back the simulation state as well as the net definition.

@vercel
Copy link

vercel bot commented Oct 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
petrinaut-hazel Ready Ready Preview Comment Oct 30, 2025 7:06pm

Comment on lines +94 to +97
setSyntax({
netDefinition: defaultNetDefinition,
simulationState: stripEmptyTuple(simulationState),
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Uses stale simulationState value in error case. When the net definition is invalid, setSimulationState() is never called (only called on line 88 in the valid case), so the simulationState variable contains stale data from a previous render. This sends incorrect simulation state back to Hazel.

Fix: Reset simulation state before calling setSyntax:

setSimulationState([]);
setSyntax({
    netDefinition: defaultNetDefinition,
    simulationState: undefined,
});
Suggested change
setSyntax({
netDefinition: defaultNetDefinition,
simulationState: stripEmptyTuple(simulationState),
});
setSimulationState([]);
setSyntax({
netDefinition: defaultNetDefinition,
simulationState: undefined,
});

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@CiaranMn CiaranMn added this pull request to the merge queue Oct 30, 2025
Merged via the queue into main with commit 9448454 Oct 30, 2025
12 of 15 checks passed
@CiaranMn CiaranMn deleted the cm/petrinaut-hazel branch October 30, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants