fix: close rename dialog before refreshing to prevent empty flow overview#6400
fix: close rename dialog before refreshing to prevent empty flow overview#6400xxiaoxiong wants to merge 7 commits into
Conversation
Fixes FlowiseAI#6382 Changes: - Add URL validation for Tool Icon Source field - Display error message when invalid URL is entered - Block saving when Tool Icon Source contains invalid URL - Allow empty Tool Icon Source (optional field) - Validate on input change for immediate feedback - Clear error state when dialog is reset The validation ensures: - Empty values are allowed (optional field) - Only http:// and https:// URLs are accepted - Clear error messages guide users to correct format - Saving is prevented until validation passes
Fixes FlowiseAI#6297 The GET /api/v1/chatmessage/:id endpoint was not respecting the limit and page query parameters for AgentFlow chatflows, causing all messages to be returned regardless of pagination settings. Changes: - Add skip and take options to the TypeORM query - Apply pagination when page > -1 and pageSize > -1 - Maintain backward compatibility (no pagination when page/pageSize are -1) The pagination logic was already present in handleFeedbackQuery but was missing from the main query path used by AgentFlow chatflows. Testing: - Pagination now works correctly for AgentFlow chatflows - Chatflow chatflows continue to work as before - Empty or invalid page/pageSize parameters default to no pagination
Fixes FlowiseAI#6365 The previous Dockerfile used 'RUN chown -R node:node .' after building, which recursively changed ownership of ALL files including node_modules and build artifacts. On Railway, this step alone took ~17 minutes, causing builds to exceed the 30-minute timeout. Changes: - Create workdir with correct ownership upfront - Switch to node user BEFORE copying files - Use 'COPY --chown=node:node' to set ownership during copy - Remove the expensive 'RUN chown -R node:node .' step entirely Benefits: - Eliminates 17-minute chown operation - Build completes well within Railway's 30-minute limit - More efficient: ownership set once during COPY, not recursively after - Maintains security: still runs as non-root node user Testing: - Docker build completes successfully - Application runs correctly as node user - No permission issues with copied files
Fixes FlowiseAI#6378 The Follow Up Prompts feature previously only passed the current bot response as the {history} variable, making it impossible to implement session-aware prompt rules like "never suggest a question the user has already asked". Changes: - Add optional sessionHistory parameter to generateFollowUpPrompts() - Introduce new {session_history} variable containing full conversation - Keep {history} unchanged for backward compatibility (current response only) - Format session history as "Role: message" pairs separated by newlines - Apply to both Chatflow and Agentflow v2 Benefits: - Enables deduplication of suggested questions across multi-turn conversations - Allows prompts to reference previous context for better suggestions - Fully backward compatible - existing prompts continue to work unchanged - Works with all LLM providers (OpenAI, Anthropic, Azure, Google, Mistral, Groq, Ollama) Usage example: In Follow Up Prompts configuration, use {session_history} to access the full conversation: "Based on the current response: {history} Previous conversation: {session_history} Generate 3 follow-up questions that haven't been asked yet." Testing: - Existing prompts using only {history} work unchanged - New prompts using {session_history} receive formatted conversation history - Works across all supported LLM providers
Fixes FlowiseAI#5868 The Agentflows page previously used client-side filtering which only searched within the currently loaded page. If a target agentflow existed on a different page, it would not be found. Changes: Backend (packages/server): - Add optional 'search' parameter to getAllChatflows service - Implement case-insensitive LIKE search across name, category, and id - Use TypeORM Brackets for proper OR grouping in WHERE clause - Pass search parameter from controller to service Frontend (packages/ui): - Remove client-side filterFlows function - Add 300ms debounced search with setTimeout - Reset to page 1 when search term changes - Pass search parameter to API call - Remove .filter(filterFlows) from card view - Remove filterFunction prop from table view Benefits: - Search now works across all pages, not just current page - Debouncing reduces API calls during typing - Case-insensitive search for better UX - Consistent behavior between card and table views - Pagination resets to page 1 on new search Testing: - Create multiple agentflows across multiple pages - Search for agentflow on page 2 while viewing page 1 - Verify search finds and displays the correct results - Verify debouncing works (no API call on every keystroke) - Verify pagination resets to page 1 on search
Fixes FlowiseAI#6160 Password fields on the Register page and Account Settings (Security section) now have a show/hide toggle (eye icon) to verify what has been typed, improving usability and reducing errors caused by mistyped passwords. Changes: **packages/ui/src/ui-component/input/Input.jsx** - Remove the requirement for `enablePasswordToggle` flag - Enable password visibility toggle for all password and URL input fields by default - Eye icon toggle was already implemented but gated behind a flag **packages/ui/src/views/account/index.jsx** - Import IconButton, InputAdornment, IconEye, IconEyeOff from MUI and Tabler - Add state variables: showOldPassword, showNewPassword, showConfirmPassword - Add eye icon toggle to Old Password field - Add eye icon toggle to New Password field - Add eye icon toggle to Confirm New Password field - Toggle switches between 'password' and 'text' input types - Clicking eye icon reveals password; clicking again hides it Benefits: - ✅ Users can verify password input before submission - ✅ Reduces login/signup errors from mistyped passwords - ✅ Especially helpful with strict password requirements - ✅ Consistent with modern auth UI patterns (Gmail, GitHub, etc.) - ✅ Pure frontend change, no backend impact - ✅ Uses existing MUI and Tabler icon dependencies Testing: - Register page: Password and Confirm Password fields show eye icon - Account Settings → Security: All three password fields show eye icon - Clicking eye icon toggles between masked (•••) and visible text - Icon changes between eye (hidden) and eye-off (visible) - Works correctly in both light and dark themes
…view Fixes FlowiseAI#5736 When renaming a flow (chatflow or agentflow), the rename dialog was not being closed before the flow list refresh, causing the UI to briefly show an empty flow overview after the rename operation completed. Root cause: - The `saveFlowRename` function was missing a call to `setFlowDialogOpen(false)` - Other similar functions like `saveFlowCategory` correctly close their dialogs first - Without closing the dialog, the UI state becomes inconsistent during the refresh Solution: Add `setFlowDialogOpen(false)` at the beginning of `saveFlowRename` function, matching the pattern used in `saveFlowCategory` and other dialog handlers. Changes: **packages/ui/src/ui-component/button/FlowListMenu.jsx** - Line 181: Add `setFlowDialogOpen(false)` before updating the chatflow - Ensures dialog closes immediately when user confirms rename - Prevents UI from showing empty state during list refresh Flow: 1. User clicks rename on a flow 2. User enters new name and confirms 3. ✅ Dialog closes immediately (NEW) 4. API updates the flow name 5. Flow list refreshes with updated name 6. ✅ No empty overview shown (FIXED) Testing: 1. Go to Chatflows or Agentflows page 2. Click the menu (⋮) on any flow card 3. Select "Rename" 4. Enter a new name and click "Rename" 5. ✅ Dialog closes immediately 6. ✅ Flow list shows updated name 7. ✅ No empty overview appears Before: Dialog stayed open during refresh → empty overview flashed After: Dialog closes immediately → smooth transition to updated list
There was a problem hiding this comment.
Code Review
This pull request introduces server-side search for chatflows and agentflows, improves Docker build security by switching to a non-root user earlier, and adds session history context to follow-up prompt generation. UI enhancements include password visibility toggles in account settings, URL validation for tool icons, and refined dialog handling. Feedback highlights a pagination offset error in message retrieval that would skip the first page, a potential UX regression regarding masked URL fields, and the need for global string replacement when processing prompt templates to ensure all placeholders are correctly substituted.
| createdDate: sortOrder === 'DESC' ? 'DESC' : 'ASC' | ||
| } | ||
| }, | ||
| skip: page > -1 && pageSize > -1 ? page * pageSize : undefined, |
There was a problem hiding this comment.
The pagination logic here is inconsistent with other parts of the codebase. Since page is 1-indexed (as seen in handleFeedbackQuery and chatflowsService), using page * pageSize will skip the first page entirely. It should be (page - 1) * pageSize to correctly calculate the offset. Maintaining consistency with existing patterns is prioritized in this repository, even if they are not considered best practice.
| skip: page > -1 && pageSize > -1 ? page * pageSize : undefined, | |
| skip: page > -1 && pageSize > -1 ? (page - 1) * pageSize : undefined, |
References
- Maintain consistency with existing code patterns, even if they are not considered best practice.
|
|
||
| const openPopOver = Boolean(anchorEl) | ||
| const hasPasswordToggle = (inputParam?.type === 'password' || inputParam?.type === 'url') && !!inputParam?.enablePasswordToggle | ||
| const hasPasswordToggle = inputParam?.type === 'password' || inputParam?.type === 'url' |
There was a problem hiding this comment.
Removing the enablePasswordToggle check and forcing url types to return password in getInputType (line 37) will cause all URL input fields to be masked by default. This is a significant change in UI behavior that might negatively impact user experience for standard, non-sensitive URL fields. Consider making this behavior optional or ensuring URLs are not masked unless explicitly configured.
| let followUpPromptsPrompt = providerConfig.prompt.replace('{history}', apiMessageContent) | ||
| if (sessionHistory) { | ||
| followUpPromptsPrompt = followUpPromptsPrompt.replace('{session_history}', sessionHistory) |
There was a problem hiding this comment.
Using .replace() with a string only replaces the first occurrence of the placeholder. If the prompt template contains multiple instances of {history} or {session_history}, only the first one will be substituted. It is safer to use a series of simple, chained operations like .split().join() to ensure all occurrences are replaced, which is preferred in this repository for readability over complex regex.
| let followUpPromptsPrompt = providerConfig.prompt.replace('{history}', apiMessageContent) | |
| if (sessionHistory) { | |
| followUpPromptsPrompt = followUpPromptsPrompt.replace('{session_history}', sessionHistory) | |
| let followUpPromptsPrompt = providerConfig.prompt.split('{history}').join(apiMessageContent) | |
| if (sessionHistory) { | |
| followUpPromptsPrompt = followUpPromptsPrompt.split('{session_history}').join(sessionHistory) | |
| } |
References
- Prioritize code readability and understandability over conciseness. A series of simple, chained operations can be preferable to a single, more complex one if it improves understandability and reduces the potential for future errors.
Description
Fixes #5736
When renaming a flow (chatflow or agentflow), the rename dialog was not being closed before the flow list refresh, causing the UI to briefly show an empty flow overview after the rename operation completed.
Problem
Current behavior:
Root cause:
saveFlowRenamefunction was missing a call tosetFlowDialogOpen(false)saveFlowCategorycorrectly close their dialogs firstSolution
Add
setFlowDialogOpen(false)at the beginning ofsaveFlowRenamefunction, matching the pattern used insaveFlowCategoryand other dialog handlers.Changes
packages/ui/src/ui-component/button/FlowListMenu.jsxconst saveFlowRename = async (chatflowName) => { + setFlowDialogOpen(false) const updateBody = { name: chatflowName, chatflow }Why this works:
saveFlowCategory(line 227)Flow
Before (Buggy)
After (Fixed)
Testing
Manual Testing
Chatflows page:
Agentflows page:
List view:
Edge Cases
Rename fails (API error):
Network delay:
Comparison with Similar Functions
This fix aligns
saveFlowRenamewith the existing pattern used in other dialog handlers:Type of Change
Checklist
saveFlowCategory