Skip to content

fix(ui): validate optional tool icon URL and add fallback icon in too…#6370

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

fix(ui): validate optional tool icon URL and add fallback icon in too…#6370
sahil2448 wants to merge 3 commits into
FlowiseAI:mainfrom
sahil2448:bugfix/tools-icon-url-validation-fallback

Conversation

@sahil2448
Copy link
Copy Markdown
Contributor

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 #6369

Summary

This PR improves the Tools icon UX by making Tool Icon Source optional while validating it when provided.

What’s fixed

  • Tool Icon Source now validates as an http / https URL only when non-empty.
  • Invalid URLs show inline validation feedback and block submit.
  • Submitting with an invalid URL shows an error toast.
  • Added a default tool icon fallback when the icon URL is empty, invalid, or broken in:
    • Tools card view
    • Tools table/list view

Problem

Previously:

  • Any random string could be saved as Tool Icon Source.
  • This caused broken icon rendering in Tools views.
  • Empty icon source did not have a consistent UI fallback.

Changes

Frontend

ToolDialog.jsx

  • Added optional URL validator (http / https only).
  • Added inline error text for invalid URL.
  • Disabled Add/Save button when URL is invalid.
  • Added submit-time snackbar error for invalid URL.
  • Kept the field optional, so empty values are allowed.

ToolsListTable.jsx

  • Added icon component with onError fallback to default tool.svg.

ItemCard.jsx

  • Added optional fallbackIconSrc support for icon rendering.
  • Added image fallback behavior for broken icon URLs.

tools/index.jsx

  • Passed default tool.svg fallback to tool cards.

Behavior after this PR

  • Empty icon source: allowed, default icon shown.
  • Valid icon URL: image shown.
  • Invalid icon URL: validation error shown, save blocked.
Screen.Recording.2026-05-12.002742.mp4

Testing done

  • Created tool with a valid icon URL → save succeeds, icon renders.
  • Created tool with invalid text (abc123) in icon source → inline error + save blocked.
  • Cleared icon source and saved tool → save succeeds, default icon renders.
  • Opened existing tools with bad icon URL → fallback icon displayed.

Scope / Notes

  • Frontend-only fix. No backend validation added in this PR.
  • No unrelated files 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 introduces a new icon handling mechanism for tools, including fallback icon support and URL validation for tool icons. It adds IconAvatar and ToolIconAvatar components to handle image loading errors and provides a validation utility in ToolDialog to ensure icon sources are valid HTTP/HTTPS URLs. Feedback includes a suggestion to prevent infinite loops in the onError handler if a fallback icon fails, a recommendation to deduplicate the avatar component logic into a shared component, and an optimization for the submit button's disabled state by using existing error state instead of re-validating on every render.

Comment thread packages/ui/src/ui-component/cards/ItemCard.jsx
Comment thread packages/ui/src/ui-component/table/ToolsListTable.jsx
Comment thread packages/ui/src/views/tools/ToolDialog.jsx
@sahil2448 sahil2448 closed this May 12, 2026
@sahil2448 sahil2448 deleted the bugfix/tools-icon-url-validation-fallback branch May 12, 2026 17:35
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.

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

1 participant