fix: improve unsaved changes confirmation message#6146
fix: improve unsaved changes confirmation message#6146daqige123 wants to merge 1 commit intoFlowiseAI:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the unsaved changes prompt message across the agent flow and canvas views to a more standard phrasing. The feedback suggests refactoring the usePrompt hook to include this message as a default value, which would eliminate string duplication and improve maintainability.
| }, [templateFlowData]) | ||
|
|
||
| usePrompt('You have unsaved changes! Do you want to navigate away?', canvasDataStore.isDirty) | ||
| usePrompt('You have unsaved changes. Are you sure you want to leave this page?', canvasDataStore.isDirty) |
There was a problem hiding this comment.
The pull request description mentions adding a default message when none is provided, but this implementation hardcodes the same string in multiple components. To improve maintainability and align with the stated objective, consider refactoring the usePrompt hook in packages/ui/src/utils/usePrompt.js to use this string as a default value for the message parameter. This would eliminate the need to repeat the string here and in packages/ui/src/views/canvas/index.jsx.
| }, [templateFlowData]) | ||
|
|
||
| usePrompt('You have unsaved changes! Do you want to navigate away?', canvasDataStore.isDirty) | ||
| usePrompt('You have unsaved changes. Are you sure you want to leave this page?', canvasDataStore.isDirty) |
There was a problem hiding this comment.
This string is identical to the one used in packages/ui/src/views/agentflowsv2/Canvas.jsx. To avoid duplication and follow the "default message" approach mentioned in the PR description, it would be better to define this string as a default value within the usePrompt hook itself rather than hardcoding it at every call site.
Description
Improve the confirmation message for unsaved changes.
Changes
Why
The previous message may be unclear or inconsistent.
This improves user understanding when navigating away with unsaved changes.