Skip to content

Fix: Auto-scale PCB on file change by keying PCBViewer with circuitJsonKey#1653

Closed
Ayushjhawar8 wants to merge 1 commit intotscircuit:mainfrom
Ayushjhawar8:TSC-81-board-resize
Closed

Fix: Auto-scale PCB on file change by keying PCBViewer with circuitJsonKey#1653
Ayushjhawar8 wants to merge 1 commit intotscircuit:mainfrom
Ayushjhawar8:TSC-81-board-resize

Conversation

@Ayushjhawar8
Copy link
Copy Markdown
Contributor

@Ayushjhawar8 Ayushjhawar8 commented Nov 2, 2025

  1. PCBViewer’s useEffect calls resetTransform() on mount or when circuitJson changes.
  2. Added a key prop using calculateCircuitJsonKey(circuitJson) in PcbViewerWithContainerHeight.tsx.
  3. When a new board loads, circuitJson (and key) changes, causing React to remount PCBViewer.
  4. The remount triggers resetTransform(), auto-scaling the view to the new board.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 2, 2025

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

Project Deployment Preview Comments Updated (UTC)
runframe Error Error Nov 2, 2025 1:08pm

Copy link
Copy Markdown
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

do you know this fixes it? If this solution works- then the issue is actually in PCBViewer not RunFrame

@Ayushjhawar8
Copy link
Copy Markdown
Contributor Author

do you know this fixes it? If this solution works- then the issue is actually in PCBViewer not RunFrame

ah yeah, so I was thinking the RunFrame workaround would solve it by forcing a remount whenever the board changes. But i think you're right. I will relook the issue

Copy link
Copy Markdown

@Anshgrover23 Anshgrover23 left a comment

Choose a reason for hiding this comment

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

@Ayushjhawar8 Can u close this one, as now the solution is in another repo.

@Ayushjhawar8
Copy link
Copy Markdown
Contributor Author

Sure @Anshgrover23. Thanks for reminding.

@Ayushjhawar8 Ayushjhawar8 deleted the TSC-81-board-resize branch November 3, 2025 12:41
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