Skip to content

chore: avoid render-phase state update in Resizable#2410

Merged
jonaslagoni merged 3 commits intoasyncapi:masterfrom
Varadraj75:fix/playground-render-state-update
Jan 18, 2026
Merged

chore: avoid render-phase state update in Resizable#2410
jonaslagoni merged 3 commits intoasyncapi:masterfrom
Varadraj75:fix/playground-render-state-update

Conversation

@Varadraj75
Copy link
Contributor

Description

This PR fixes a React render-phase state update in the Modelina Playground.
Previously, layout state was updated inside useTransform, which runs during render and caused React warnings. The state update has been moved to the drag handler, ensuring rendering remains side-effect free and StrictMode-safe.

Related Issue

Fixes #2409

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint).
  • Tests have been added or updated to cover the changes.
  • Documentation has been updated to reflect the changes.
  • All tests pass successfully locally.(npm run test).

Additional Notes

This change does not alter runtime behavior. It only removes a render-phase side effect that triggered React warnings during development and StrictMode.

Copilot AI review requested due to automatic review settings January 18, 2026 11:18
@Varadraj75 Varadraj75 requested a review from ashmitjsg as a code owner January 18, 2026 11:18
@netlify
Copy link

netlify bot commented Jan 18, 2026

Deploy Preview for modelina ready!

Name Link
🔨 Latest commit 7a94b7b
🔍 Latest deploy log https://app.netlify.com/projects/modelina/deploys/696cc2cb470bfe00089c861e
😎 Deploy Preview https://deploy-preview-2410--modelina.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Varadraj75 Varadraj75 changed the title [fix]: avoid render-phase state update in Resizable fix(playground): avoid render-phase state update in Resizable Jan 18, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a React render-phase state update warning by moving a dispatch call from inside useTransform (which runs during render) to an onDrag event handler. The goal is to eliminate React StrictMode warnings and follow React best practices by keeping renders side-effect free.

Changes:

  • Simplified useTransform to only calculate width, removing the state dispatch
  • Added onDrag handler to the draggable separator to dispatch state updates during drag events
  • Updated useEffect dependency array to include state.editorSize and dragableX
  • Minor indentation fixes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Varadraj75 and others added 2 commits January 18, 2026 16:53
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

Please retry analysis of this Pull-Request directly on SonarQube Cloud

@jonaslagoni jonaslagoni changed the title fix(playground): avoid render-phase state update in Resizable chore: avoid render-phase state update in Resizable Jan 18, 2026
@coveralls
Copy link

Pull Request Test Coverage Report for Build 21110926242

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 91.026%

Totals Coverage Status
Change from base Build 20639689786: 0.0%
Covered Lines: 6943
Relevant Lines: 7420

💛 - Coveralls

@jonaslagoni jonaslagoni merged commit 509dd08 into asyncapi:master Jan 18, 2026
18 checks passed
@jonaslagoni
Copy link
Member

@all-contributors please add @Varadraj75 for code

@allcontributors
Copy link
Contributor

@jonaslagoni

I've put up a pull request to add @Varadraj75! 🎉

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.

[BUG] PlaygroundLayoutProvider state update triggered during Resizable render

3 participants