You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When picking assets, allow selecting multiple assets at once in the file manager and confirming with a single Add {n} button, instead of picking them one at a time. The most obvious use case is a CMS asset field with multiple = true, where you often want to add many images in one go.
Problem
Today the file manager has two separate "selection" concepts:
Picker mode (choosing an asset for a field/layer) is single-select only. openFileManager(onSelect, assetId, category) takes one callback that fires for a single asset and closes the dialog.
Bulk management mode (checkbox multi-select) only exists for move/delete operations inside the manager.
As a result, populating a multiple = true asset field means repeating the whole flow for every asset:
In CollectionItemSheet.tsx, each asset is added via the Add {label} button → openFileManager(...) → pick one → dialog closes → repeat.
Same one-at-a-time pattern in the field default editor (AssetDefaultMultiple in FieldFormDialog.tsx).
For an item with 10–20 images this is tedious (open, pick, reopen, pick, ...).
Proposed solution
Add a multi-select picker mode to FileManagerDialog:
When opened from a context that accepts multiple assets, show the existing checkboxes for selection (reuse the selectedAssetIds: Set<string> machinery already used for bulk move/delete).
Show a confirm button labelled Add {n} (reflecting the number of selected assets), disabled when nothing is selected — mirroring the Export {n} pattern referenced in feat: export collection items to CSV #348.
Return the full array of selected assets to the caller in one callback, instead of firing per-asset.
Then wire the multi-select mode into the multi-asset flows:
CollectionItemSheet.tsx — the Add {label} button for isMultipleAssetField(field) opens the picker in multi-select mode, appends all chosen assets (with the existing type validation via isValidAssetForField and dedupe), and stores the resulting JSON.stringify(assetIds).
AssetDefaultMultiple in FieldFormDialog.tsx — same treatment for field default values.
Implementation notes
openFileManager would need to support a multi-select variant, e.g. an onSelectMany?: (assets: Asset[]) => void callback or a multiple?: boolean flag (stores/useEditorStore.ts, consumed in YCodeBuilderMain.tsx).
The checkbox UI already exists on FileGridItem (currently gated to bulk move/delete) — the main work is letting picker mode reuse it and swapping the footer action to Add {n}.
Category/type filtering (getFileManagerCategory, isValidAssetForField) should still apply so only valid assets can be added.
Context
Main manager: app/(builder)/ycode/components/FileManagerDialog.tsx
Multi-asset field flow: app/(builder)/ycode/components/CollectionItemSheet.tsx, FieldFormDialog.tsx (AssetDefaultMultiple)
Detection/util: isMultipleAssetField in lib/collection-field-utils.ts, parseMultiAssetFieldValue in lib/multi-asset-utils.ts
Opener state: stores/useEditorStore.ts (openFileManager), wired in YCodeBuilderMain.tsx
Open questions
Should multi-select be a distinct mode, or should any picker allow it when the target field accepts multiple?
Should selection persist across folder navigation within a single picker session?
Feature request
When picking assets, allow selecting multiple assets at once in the file manager and confirming with a single Add {n} button, instead of picking them one at a time. The most obvious use case is a CMS asset field with
multiple = true, where you often want to add many images in one go.Problem
Today the file manager has two separate "selection" concepts:
openFileManager(onSelect, assetId, category)takes one callback that fires for a single asset and closes the dialog.As a result, populating a
multiple = trueasset field means repeating the whole flow for every asset:CollectionItemSheet.tsx, each asset is added via the Add {label} button →openFileManager(...)→ pick one → dialog closes → repeat.AssetDefaultMultipleinFieldFormDialog.tsx).For an item with 10–20 images this is tedious (open, pick, reopen, pick, ...).
Proposed solution
Add a multi-select picker mode to
FileManagerDialog:selectedAssetIds: Set<string>machinery already used for bulk move/delete).Export {n}pattern referenced in feat: export collection items to CSV #348.Then wire the multi-select mode into the multi-asset flows:
CollectionItemSheet.tsx— the Add {label} button forisMultipleAssetField(field)opens the picker in multi-select mode, appends all chosen assets (with the existing type validation viaisValidAssetForFieldand dedupe), and stores the resultingJSON.stringify(assetIds).AssetDefaultMultipleinFieldFormDialog.tsx— same treatment for field default values.Implementation notes
openFileManagerwould need to support a multi-select variant, e.g. anonSelectMany?: (assets: Asset[]) => voidcallback or amultiple?: booleanflag (stores/useEditorStore.ts, consumed inYCodeBuilderMain.tsx).FileGridItem(currently gated to bulk move/delete) — the main work is letting picker mode reuse it and swapping the footer action to Add {n}.getFileManagerCategory,isValidAssetForField) should still apply so only valid assets can be added.Context
app/(builder)/ycode/components/FileManagerDialog.tsxapp/(builder)/ycode/components/CollectionItemSheet.tsx,FieldFormDialog.tsx(AssetDefaultMultiple)isMultipleAssetFieldinlib/collection-field-utils.ts,parseMultiAssetFieldValueinlib/multi-asset-utils.tsstores/useEditorStore.ts(openFileManager), wired inYCodeBuilderMain.tsxOpen questions