Skip to content

fix(apollo-react): stabilize panOnDrag array reference to prevent unnecessary re-renders#274

Merged
snuziale merged 1 commit intomainfrom
fix/base-canvas-pan-on-drag
Feb 27, 2026
Merged

fix(apollo-react): stabilize panOnDrag array reference to prevent unnecessary re-renders#274
snuziale merged 1 commit intomainfrom
fix/base-canvas-pan-on-drag

Conversation

@snuziale
Copy link
Collaborator

Summary

  • Extract inline [1] array literal in BaseCanvas panOnDrag prop to a stable PAN_ON_DRAG constant, preventing a new reference on every render

Copilot AI review requested due to automatic review settings February 27, 2026 06:01
@github-actions
Copy link

github-actions bot commented Feb 27, 2026

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

Project Deployment Review Updated (PT)
apollo-canvas 🟢 Ready Preview, Logs Feb 26, 2026, 10:05:26 PM
apollo-ui-react 🟢 Ready Preview, Logs Feb 26, 2026, 10:04:15 PM
apollo-vertex 🟢 Ready Preview, Logs Feb 26, 2026, 10:03:40 PM
apollo-wind 🟢 Ready Preview, Logs Feb 26, 2026, 10:03:08 PM

@github-actions
Copy link

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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 performance issue in the BaseCanvas component by extracting an inline array literal [1] to a stable constant PAN_ON_DRAG. This prevents creating a new array reference on every render, which could trigger unnecessary re-renders in the ReactFlow component due to reference inequality checks.

Changes:

  • Extract inline [1] array to PAN_ON_DRAG constant to stabilize reference across renders

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/apollo-react/src/canvas/components/BaseCanvas/BaseCanvas.tsx Updated panOnDrag prop to use the new PAN_ON_DRAG constant instead of inline [1] array
packages/apollo-react/src/canvas/components/BaseCanvas/BaseCanvas.constants.ts Added PAN_ON_DRAG constant with proper tuple type annotation and explanatory comment

@snuziale snuziale merged commit 53c897c into main Feb 27, 2026
28 checks passed
@snuziale snuziale deleted the fix/base-canvas-pan-on-drag branch February 27, 2026 17:40
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