Skip to content

fix(web): hide folder tab in agent JSON import uploader - #16754

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
euvre:fix/agent-upload-folder-tab
Jul 8, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
euvre:fix/agent-upload-folder-tab

Conversation

@euvre

@euvre euvre commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The agent JSON import dialog only supports uploading a single DSL file. However, the shared FileUploader component rendered both the Files and Folder tabs. Selecting a folder containing multiple files caused the error shown below.

agent-import-folder-error

Changes

  • Added a prop to (defaults to to preserve existing behavior).
  • Set in the agent JSON import form so only the single-file upload tab is available.

How to test

  1. Go to Agents -> Create agent -> Import JSON.
  2. Verify that only the Files tab is shown in the DSL upload area.
  3. Select a single JSON file and save.

Labels

/ci

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 941c70bc-0cab-47e6-a3ad-586b77187de8

📥 Commits

Reviewing files that changed from the base of the PR and between 0f08dc0 and 975c066.

📒 Files selected for processing (2)
  • web/src/components/file-uploader.tsx
  • web/src/pages/agents/upload-agent-dialog/upload-agent-form.tsx

📝 Walkthrough

Walkthrough

The FileUploader component gains a new optional showFolderTab prop (default true) that conditionally renders the folder tab, its trigger, and folder-selection UI. UploadAgentForm now passes showFolderTab={false} to hide the folder tab for its single-file DSL upload.

Changes

Optional Folder Tab in FileUploader

Layer / File(s) Summary
Add showFolderTab prop and conditional rendering
web/src/components/file-uploader.tsx
Adds showFolderTab?: boolean to FileUploaderProps (default true), destructures it in the component, and conditionally renders the folder TabsTrigger and TabsContent (including hidden folder input and folder dropzone) based on its value.
Disable folder tab in upload agent form
web/src/pages/agents/upload-agent-dialog/upload-agent-form.tsx
Passes showFolderTab={false} to FileUploader to hide the folder tab for single JSON (DSL) file uploads.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A tab for folders, hide or show,
One little prop makes it so.
Agents now upload just one file,
No folder clutter, all in style. 🐇📁

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed It clearly states the main change: hiding the folder tab in the agent JSON import uploader.
Description check ✅ Passed It describes the same change and test flow, and is clearly related to the diff.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@euvre euvre added the ci Continue Integration label Jul 8, 2026

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review: PR #16754 — fix(web): hide folder tab in agent JSON import uploader

Author: euvre | +32/-18 | 2 files

Summary

This PR addresses a bug where the agent JSON import dialog showed both "Files" and "Folder" tabs from the shared FileUploader component. Selecting a folder of multiple files caused errors since the dialog expects a single DSL file. The fix adds a showFolderTab prop to FileUploader (default true for backward compatibility) and sets it to false in the agent upload form.

✅ What's Good

  1. Minimal, focused change — only 2 files touched, +32/-18 lines. The diff is easy to review.
  2. Backward compatible — showFolderTab defaults to true, so all existing callers behave identically without changes.
  3. JSDoc added on the new prop — good practice for a shared component.
  4. Correct defaulting — Tabs defaultValue="file" ensures no broken state when folder tab is hidden. The Tabs component gracefully renders a single tab.
  5. CodeRabbit already gave a clean pass — no actionable issues found.

🔍 Considerations

Other single-file consumers exist — The MCP import dialog, Gmail token field, and Google Drive token field are also single-file JSON uploaders (maxFileCount={1}, .json only) and currently still show the folder tab. Consider whether they should also benefit from this fix. Out of scope for this PR, but worth a follow-up.

🧪 Testing

The test steps described are correct. Verified the following through code review:

  • The Tabs defaultValue="file" ensures no broken state when folder tab is hidden
  • The default true value preserves all other callers unchanged
  • Conditional JSX wrapping ({showFolderTab && (...) }) handles both tabs (trigger + content) consistently

Verdict

LGTM — clean fix, ready to merge. No regressions introduced.

@wangq8
wangq8 merged commit a41fef4 into infiniflow:main Jul 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants