Skip to content

fix(ui): validate optional tool icon URL and add fallback icon if user doesn't input URL#6383

Open
sahil2448 wants to merge 3 commits into
FlowiseAI:mainfrom
sahil2448:bugfix/tools-icon-url-validation-fallback
Open

fix(ui): validate optional tool icon URL and add fallback icon if user doesn't input URL#6383
sahil2448 wants to merge 3 commits into
FlowiseAI:mainfrom
sahil2448:bugfix/tools-icon-url-validation-fallback

Conversation

@sahil2448
Copy link
Copy Markdown
Contributor

@sahil2448 sahil2448 commented May 14, 2026

BugFix : Added Validation check for TOOL ICON SOURCE Field in Tools Dialogue, and add a default icon image if user has not provided

Related issue

Closes #6382

Summary

This PR improves the Tools icon experience by keeping Tool Icon Source optional while validating it when a value is provided. It also adds a safe fallback icon so Tools never render with a broken or empty icon in list/card views.

What’s fixed

  • Tool Icon Source now accepts only valid http / https URLs when a value is entered.
  • Empty icon source is still allowed.
  • Invalid icon values show inline validation feedback and block save.
  • Existing invalid icon values are validated when the edit dialog opens.
  • Tools list/table view now shows a default fallback icon when:
    • the icon source is empty
    • the icon URL is invalid
    • the image fails to load
Screen.Recording.2026-05-14.164541.mp4

Problem

Previously:

  • Any random string could be saved in Tool Icon Source.
  • This caused broken or missing icons in the Tools list/card views.
  • There was no consistent fallback when the icon source was empty or invalid.

Changes

ToolDialog.jsx

  • Added URL validation for Tool Icon Source.
  • Kept the field optional, so empty values are allowed.
  • Added inline error text for invalid URLs.
  • Disabled Add/Save when the icon URL is invalid.
  • Validated existing icon values when the dialog opens in edit mode.

ToolsTable.jsx

  • Added a safe default fallback icon for tool rows.
  • Prevented broken image rendering when iconSrc is missing or invalid.

Behavior after this PR

  • Empty icon source: allowed, tool saves successfully, fallback icon is shown.
  • Valid icon URL: tool saves successfully, custom icon is shown.
  • Invalid icon value such as abc123: validation error is shown and save is blocked.

Testing done

  • Created a tool with a valid icon URL → saved successfully and icon rendered.
  • Created a tool with invalid text in icon source → validation error shown and save blocked.
  • Left icon source empty → saved successfully and default icon shown.
  • Opened an existing tool with bad icon URL → fallback icon displayed in the Tools view.

Scope / Notes

  • Frontend-only fix.
  • No backend validation changes were added in this PR.
  • No unrelated files were changed.

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 implements URL validation for tool icons in the ToolDialog component and refactors styling in ToolsListTable.jsx. The code changes include adding validation logic for icon URLs, updating the UI to display error messages, and modifying the save button's disabled state. Feedback from the reviewer identifies a bug where validation is not triggered on initial load in edit mode and points out dead JSX code. The reviewer suggests refactoring the validation logic to use useMemo for better synchronization and recommends reverting the use of hardcoded MUI class names in favor of library constants to maintain code robustness.

Comment thread packages/ui/src/views/tools/ToolDialog.jsx Outdated
Comment thread packages/ui/src/views/tools/ToolDialog.jsx Outdated
Comment thread packages/ui/src/ui-component/table/ToolsListTable.jsx Outdated
@sahil2448
Copy link
Copy Markdown
Contributor Author

Please anyone don't open PR...i am working on this issue...there are still some issues in my code...so i am improving it and will complete it sooner !

@sahil2448
Copy link
Copy Markdown
Contributor Author

Added all the changes which were suggested by Gemini Bot !

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.

Bug: Tool Icon Source accepts invalid values and lacks default fallback icon

1 participant