Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Sep 19, 2025

This is a good practice in general to help reduce unnecessary re-rendering.
It's also mentioned in react flow's docs: https://reactflow.dev/learn/advanced-use/performance#memoize-functions

We already do this in the diagramming package: https://github.com/mongodb-js/diagramming/blob/e5edc84fcc4fb6c960333c690cf0e291cd75c6c3/src/components/canvas/canvas.tsx#L146

@Anemy Anemy requested a review from a team as a code owner September 19, 2025 19:25
@Anemy Anemy requested review from gribnoysup and Copilot September 19, 2025 19:25
@Anemy Anemy added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Sep 19, 2025
Copy link
Contributor

@Copilot 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

Memoizes diagram interaction handlers to reduce unnecessary re-renders per React Flow performance guidance. Extracts static zoom config and replaces inline anonymous callbacks with stable useCallback references.

  • Introduces memoized callbacks for node, edge, field, pane, connect, and drag events
  • Extracts fitViewOptions into a top-level constant (ZOOM_OPTIONS)
  • Refactors inline handlers in JSX to referenced callbacks

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Anemy Anemy merged commit acae18a into main Sep 19, 2025
57 of 59 checks passed
@Anemy Anemy deleted the memoize-funcitons-passed-to-diagramming branch September 19, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants