Skip to content

Conversation

@seveibar
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Jan 28, 2026

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

Project Deployment Actions Updated (UTC)
runframe Ready Ready Preview, Comment Jan 30, 2026 6:51am

Request Review

Comment on lines +174 to +178
const [internalShowSchematicDebugGrid, setInternalShowSchematicDebugGrid] =
useState(showSchematicDebugGridProp)
const [internalShowSchematicPorts, setInternalShowSchematicPorts] = useState(
showSchematicPortsProp,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

The internal state is initialized with prop values but never updates when props change. If showSchematicDebugGridProp or showSchematicPortsProp change from the parent while handlers are not provided, the component will continue using stale values.

To fix, add useEffect to sync internal state with prop changes:

useEffect(() => {
  if (!onChangeShowSchematicDebugGrid) {
    setInternalShowSchematicDebugGrid(showSchematicDebugGridProp)
  }
}, [showSchematicDebugGridProp, onChangeShowSchematicDebugGrid])

useEffect(() => {
  if (!onChangeShowSchematicPorts) {
    setInternalShowSchematicPorts(showSchematicPortsProp)
  }
}, [showSchematicPortsProp, onChangeShowSchematicPorts])

This ensures props remain the source of truth even in uncontrolled mode.

Suggested change
const [internalShowSchematicDebugGrid, setInternalShowSchematicDebugGrid] =
useState(showSchematicDebugGridProp)
const [internalShowSchematicPorts, setInternalShowSchematicPorts] = useState(
showSchematicPortsProp,
)
const [internalShowSchematicDebugGrid, setInternalShowSchematicDebugGrid] =
useState(showSchematicDebugGridProp)
const [internalShowSchematicPorts, setInternalShowSchematicPorts] = useState(
showSchematicPortsProp,
)
useEffect(() => {
if (!onChangeShowSchematicDebugGrid) {
setInternalShowSchematicDebugGrid(showSchematicDebugGridProp)
}
}, [showSchematicDebugGridProp, onChangeShowSchematicDebugGrid])
useEffect(() => {
if (!onChangeShowSchematicPorts) {
setInternalShowSchematicPorts(showSchematicPortsProp)
}
}, [showSchematicPortsProp, onChangeShowSchematicPorts])

Spotted by Graphite Agent

Fix in Graphite


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

@seveibar
Copy link
Contributor Author

@Ayushjhawar8 this isn't working, can you look into it? we just need to get the view menu working so the user can toggle on schematic ports and stuff, there might be a keying issue or something idk https://schematic-viewer.vercel.app/?fixtureId=%7B%22path%22%3A%22examples%2Fexample17-schematic-ports.fixture.tsx%22%7D

Comment on lines 728 to +729
solverEvents={solverEvents}
showSchematicDebugGrid={showSchematicDebugGrid}
Copy link
Contributor

Choose a reason for hiding this comment

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

onChangeShowSchematicDebugGrid={setShowSchematicDebugGrid}
onChangeShowSchematicPorts={setShowSchematicPorts}

i think we need to add these here aswell as without them, CircuitJsonPreview would using its internal state instead of RunFrame 's state, which might be causing the View menu toggles to be disconnected from the SchematicViewer.

Copy link
Contributor

Choose a reason for hiding this comment

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

image

@Ayushjhawar8
Copy link
Contributor

@seveibar Please check

@seveibar
Copy link
Contributor Author

nice

@seveibar seveibar merged commit 94ff797 into main Jan 30, 2026
6 checks passed
@seveibar seveibar deleted the schematic-view-toggles branch January 30, 2026 06:54
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