-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set default zoom to workflows #7331
Conversation
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.
PR Summary
This PR improves the default zoom behavior of the workflow visualizer in the Twenty application, addressing the issue of initial zoom being too large.
- Added
fitView
function call inWorkflowDiagramCanvas.tsx
with fixed min/max zoom values of 1.3 - Implemented re-rendering of
WorkflowDiagramCanvas
component with new key on workflow version change - Modified
WorkflowDiagramCreateStepNode.tsx
to use 'small' size for the IconButton - Removed reliance on
fitView
property ofReactflow
component, usingonInit
callback instead - Ensured consistent viewing experience across different workflow versions
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
lgtm
Log
|
## Improvements - This PR calls `fitView` when the Reactflow component inits. It tries to fit the flow in a view with a fixed min and max zoom. - Every time the WorkflowDiagramCanvas is rendered for a different `workflowVersionId`, the `fitView` will be re-called. This is implemented with a React `key`. - The canvas will be re-rendered when an activated/deactivated version is updated (and a new draft version is created.) - It will also be re-rendered when the user selects another workflow version and this doesn't cause the `WorkflowDiagramCanvas` component to unmount. It happens if the user wants to go the previous or next workflow or workflow version. ## Previous Behavior ![CleanShot 2024-09-30 at 10 32 06@2x](https://github.com/user-attachments/assets/ea43cd43-8c9c-491c-a535-8cca9168fb22) ## New Behavior ![CleanShot 2024-09-30 at 10 26 47@2x](https://github.com/user-attachments/assets/7bfb91b2-1782-47a1-ab5a-3eaa9f1be923) https://github.com/user-attachments/assets/cb73f456-58b1-49c3-bd31-a1650810e9dd ## Notes Closes twentyhq#7047 This PR is a simplification of twentyhq#7151. We'll have to improve the way we manage zoom in another PR.
Improvements
fitView
when the Reactflow component inits. It tries to fit the flow in a view with a fixed min and max zoom.workflowVersionId
, thefitView
will be re-called. This is implemented with a Reactkey
.WorkflowDiagramCanvas
component to unmount. It happens if the user wants to go the previous or next workflow or workflow version.Previous Behavior
New Behavior
CleanShot.2024-09-30.at.10.29.44.mp4
Notes
Closes #7047
This PR is a simplification of #7151. We'll have to improve the way we manage zoom in another PR.