Skip to content

fix: close rename dialog before refreshing to prevent empty flow overview#6400

Open
xxiaoxiong wants to merge 7 commits into
FlowiseAI:mainfrom
xxiaoxiong:fix/rename-flow-empty-overview-5736
Open

fix: close rename dialog before refreshing to prevent empty flow overview#6400
xxiaoxiong wants to merge 7 commits into
FlowiseAI:mainfrom
xxiaoxiong:fix/rename-flow-empty-overview-5736

Conversation

@xxiaoxiong
Copy link
Copy Markdown

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:

  1. User renames a flow and confirms
  2. Rename dialog stays open during API call
  3. Flow list refreshes while dialog is still open
  4. UI shows empty flow overview
  5. Dialog eventually closes, but the damage is done

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

 const saveFlowRename = async (chatflowName) => {
+    setFlowDialogOpen(false)
     const updateBody = {
         name: chatflowName,
         chatflow
     }

Why this works:

  • Closes dialog immediately when user confirms rename
  • Prevents UI from showing empty state during list refresh
  • Matches the pattern used in saveFlowCategory (line 227)
  • Ensures consistent behavior across all dialog handlers

Flow

Before (Buggy)

  1. User clicks rename on a flow
  2. User enters new name and confirms
  3. ❌ Dialog stays open
  4. API updates the flow name
  5. Flow list refreshes
  6. ❌ Empty overview appears
  7. Dialog closes

After (Fixed)

  1. User clicks rename on a flow
  2. User enters new name and confirms
  3. ✅ Dialog closes immediately
  4. API updates the flow name
  5. Flow list refreshes with updated name
  6. ✅ No empty overview shown

Testing

Manual Testing

  1. Chatflows page:

    • Go to Chatflows page
    • Click the menu (⋮) on any flow card
    • Select "Rename"
    • Enter a new name and click "Rename"
    • ✅ Dialog closes immediately
    • ✅ Flow list shows updated name
    • ✅ No empty overview appears
  2. Agentflows page:

    • Go to Agentflows page
    • Click the menu (⋮) on any flow card
    • Select "Rename"
    • Enter a new name and click "Rename"
    • ✅ Dialog closes immediately
    • ✅ Flow list shows updated name
    • ✅ No empty overview appears
  3. List view:

    • Switch to list view (table)
    • Rename a flow
    • ✅ Same smooth behavior

Edge Cases

  1. Rename fails (API error):

    • Dialog closes immediately
    • Error snackbar appears
    • Flow list remains unchanged
    • ✅ No empty overview
  2. Network delay:

    • Dialog closes immediately
    • Loading state shows during refresh
    • ✅ No empty overview

Comparison with Similar Functions

This fix aligns saveFlowRename with the existing pattern used in other dialog handlers:

// saveFlowCategory (line 226-244) - CORRECT PATTERN
const saveFlowCategory = async (categories) => {
    setCategoryDialogOpen(false)  // ✅ Close dialog first
    // ... update logic
}

// saveFlowRename (line 180-214) - WAS MISSING THIS
const saveFlowRename = async (chatflowName) => {
    setFlowDialogOpen(false)  // ✅ NOW ADDED
    // ... update logic
}

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • Fix is minimal (1 line change)
  • Matches existing pattern used in saveFlowCategory
  • Works for both Chatflows and Agentflows
  • Works in both card view and list view
  • Handles error cases gracefully
  • No breaking changes

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
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
skip: page > -1 && pageSize > -1 ? page * pageSize : undefined,
skip: page > -1 && pageSize > -1 ? (page - 1) * pageSize : undefined,
References
  1. 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'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Comment on lines +35 to +37
let followUpPromptsPrompt = providerConfig.prompt.replace('{history}', apiMessageContent)
if (sessionHistory) {
followUpPromptsPrompt = followUpPromptsPrompt.replace('{session_history}', sessionHistory)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a flow opens an empty flow overview

1 participant