Skip to content

Conversation

@lefarcen
Copy link
Contributor

@lefarcen lefarcen commented Dec 18, 2025

Summary

Remove file type restrictions for workflow variables and fix file download issues.

File Type Restrictions Removed:

  • Removed resource type selector from ResourceTypeForm, defaulting to all types
  • Allow any file type upload without extension restrictions
  • File-to-variable conversion now accepts all file types with default resourceTypes: ['document', 'image', 'audio', 'video']

Download Fix:

  • Fixed empty file download in unsupported file preview by using useDownloadFile hook
  • Added loading state for download button

Import Modal:

  • Disabled import button while files are uploading

Impact Areas

  • Free-form Canvas Interface
  • Workflow Variables
  • Resource Library

Checklist

  • I understand that this PR may be closed in case there was no previous discussion or issues.
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Summary by CodeRabbit

  • Bug Fixes

    • Improved file import safety by preventing save actions while files are uploading.
  • Improvements

    • Added visual feedback during file downloads to indicate download progress and state.

✏️ Tip: You can customize this high-level summary in your review settings.

mrcfps and others added 4 commits December 17, 2025 22:18
Staging Release 20251217
feat: Add invite page to public access pages whitelist (#1874)

feat: Add invite page check to `useIsSharePage` hook, ignore `.serena` files, and configure SCSS formatter in VS Code.

Co-authored-by: lefarcen <[email protected]>
refactor: update default selected credit pack in CreditInsufficientModal (#1876)

* Removed credit pack options for 100 and 500 credits.
* Changed default selected credit pack from 100 to 1000 for users with a paid subscription.
* Ensured consistency in credit pack options displayed for users.

Co-authored-by: Siri-Ray <[email protected]>
…ile download loading states, and configure Serena project settings.
@lefarcen lefarcen closed this Dec 18, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Refactors file download functionality to use a centralized useDownloadFile hook with loading state tracking. Simplifies the resource type form by removing multi-type resource filtering logic and custom tag rendering. Adds a check to prevent saving imports when files are still uploading.

Changes

Cohort / File(s) Summary
File preview download refactoring
packages/ai-workspace-common/src/components/canvas/canvas-resources/file-preview/index.tsx, packages/ai-workspace-common/src/components/canvas/canvas-resources/file-preview/unsupported.tsx
Replaces local download handler with useDownloadFile hook. Adds isDownloading prop to UnsupportedRenderer to reflect download state in UI. Updates Download Button to use loading and disabled states based on isDownloading.
Resource type form simplification
packages/ai-workspace-common/src/components/canvas/workflow-variables/resource-type-form.tsx
Removes multi-type resource type selection logic, custom tag rendering, and file extension validation. Upload component no longer receives accept prop. Streamlines component to handle value uploads without resource type filtering.
Import resource upload state
packages/ai-workspace-common/src/components/import-resource/index.tsx
Disables save action when any item in waitingList has uploading file status, preventing premature imports.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • file-preview components: Verify useDownloadFile hook integration, contentType fallback logic, and prop wiring to child components
  • resource-type-form.tsx: Confirm removal of file acceptance validation doesn't break existing file filtering expectations; ensure file upload error handling remains intact
  • import-resource/index.tsx: Validate upload state check logic and effect dependency chain

Possibly related PRs

  • PR #1630: Modifies use-download-file.ts hook that is now consumed by this PR's file preview changes
  • PR #1586: Parallel refactoring to migrate file download logic to the useDownloadFile hook pattern in other components
  • PR #1391: Prior changes to ResourceTypeForm affecting form validation and file acceptance logic that this PR further simplifies

Suggested reviewers

  • alchemistklk
  • mrcfps

Poem

🐰 A hop and a click, the downloads now flow,
With hooks held tight and states aglow!
Resource forms shed their filters with glee,
Simpler and cleaner for all to see.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mashu/remove-file-type2

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1bba87d and dde2473.

📒 Files selected for processing (4)
  • packages/ai-workspace-common/src/components/canvas/canvas-resources/file-preview/index.tsx (3 hunks)
  • packages/ai-workspace-common/src/components/canvas/canvas-resources/file-preview/unsupported.tsx (2 hunks)
  • packages/ai-workspace-common/src/components/canvas/workflow-variables/resource-type-form.tsx (2 hunks)
  • packages/ai-workspace-common/src/components/import-resource/index.tsx (1 hunks)

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 and usage tips.

@lefarcen lefarcen reopened this Dec 18, 2025
@lefarcen lefarcen closed this Dec 18, 2025
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.

3 participants