Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: prisma/studio
Length of output: 2741
🏁 Script executed:
Repository: prisma/studio
Length of output: 8517
🌐 Web query:
React Flow minZoom maxZoom fitView documentation💡 Result:
In React Flow, minZoom, maxZoom, and fitView are core features used to manage the viewport and its interaction constraints. ### 1. minZoom and maxZoom These properties define the allowed scaling range for the viewport [1][2]. * As Props: You can pass
minZoomandmaxZoomdirectly to the<ReactFlow />component to set global limits for the entire flow [1][2]. The default values are0.5forminZoomand2formaxZoom[1][2]. * In fitView: When calling thefitView()method, you can optionally override these limits specifically for that transition by passing them as part of thefitViewOptionsobject [3][4][5]. If these options are not provided,fitViewwill respect the global limits set on the component [6]. ### 2. fitView ThefitViewfeature ensures that the viewport is zoomed and panned to make all (or a specified subset) of your nodes visible [1][4]. * Initial View: To apply this on load, set thefitViewprop totrueon the<ReactFlow />component [1]. You can customize the initial behavior by passing an object to thefitViewOptionsprop [1]. * Imperative Call: You can trigger this programmatically using thefitViewmethod available on theReactFlowInstance(often accessed via theonInitcallback or theuseReactFlowhook) [1][4]. ### 3. fitViewOptions ThefitViewOptionsobject allows you to customize how the viewport adjusts [3]. Common options include: * padding: Defines spacing around the edges of the view (supports pixels, percentages, and numeric ratios) [3][7]. * minZoom / maxZoom: Overrides for the zooming constraints during the fit [3][5]. * duration: If provided, creates a smooth transition (in milliseconds) instead of an instant jump [3][4]. * includeHiddenNodes: A boolean to determine if hidden nodes should be calculated in the view [3][5]. * nodes: An array of specific node objects or IDs if you wish to fit the view to only a subset of elements [3][5]. The<Controls />component also usesfitViewOptionsif you wish to customize the behavior of the built-in "fit view" button [8].Citations:
Add regression assertions for the zoom limits.
Assert
latestReactFlowProps?.minZoomis0.05andlatestReactFlowProps?.maxZoomis5to prevent reversion to React Flow defaults. These limits also apply tofitView.🤖 Prompt for AI Agents
Source: MCP tools