MCPcopy
hub / github.com/marimo-team/marimo / StorageEntryRow

Function StorageEntryRow

frontend/src/components/storage/storage-inspector.tsx:408–595  ·  view source on GitHub ↗
({
  entry,
  rowKey,
  namespace,
  protocol,
  rootPath,
  backendType,
  depth,
  locale,
  searchValue,
  onOpenFile,
})

Source from the content-addressed store, hash-verified

406 searchValue: string;
407 onOpenFile: (info: OpenFileInfo) => void;
408}> = ({
409 entry,
410 rowKey,
411 namespace,
412 protocol,
413 rootPath,
414 backendType,
415 depth,
416 locale,
417 searchValue,
418 onOpenFile,
419}) => {
420 const [isExpanded, setIsExpanded] = useState(false);
421 const { entriesByPath } = useStorage();
422 const addCodeToNewCell = useAddCodeToNewCell();
423 const isDir = entry.kind === "directory";
424 const name = displayName(entry.path);
425 const hasSearch = !!searchValue.trim();
426
427 const selfMatches =
428 isDir &&
429 hasSearch &&
430 name.toLowerCase().includes(searchValue.trim().toLowerCase());
431
432 // During a search, auto-expand directories whose loaded descendants match
433 const hasMatchingDescendants =
434 isDir &&
435 hasSearch &&
436 !!entriesByPath
437 .get(storagePathKey(namespace, directoryPrefix(entry.path)))
438 ?.some((child) =>
439 entryMatchesSearch(child, { namespace, searchValue, entriesByPath }),
440 );
441
442 // Folder is shown expanded by manual toggle OR by search auto-expand
443 const effectiveExpanded = isExpanded || hasMatchingDescendants;
444
445 const handleDownload = useCallback(async () => {
446 try {
447 const result = await DownloadStorage.request({
448 namespace,
449 path: entry.path,
450 });
451 if (result.error) {
452 toast({
453 title: "Download failed",
454 description: result.error,
455 variant: "danger",
456 });
457 return;
458 }
459 if (result.url) {
460 downloadByURL(result.url, result.filename ?? "download");
461 }
462 } catch (error) {
463 Logger.error("Failed to download storage entry", error);
464 toast({
465 title: "Download failed",

Callers

nothing calls this directly

Calls 15

useStorageFunction · 0.90
useAddCodeToNewCellFunction · 0.90
storagePathKeyFunction · 0.90
toastFunction · 0.90
downloadByURLFunction · 0.90
cnFunction · 0.90
renderFileIconFunction · 0.90
formatBytesFunction · 0.90
copyToClipboardFunction · 0.90
directoryPrefixFunction · 0.85
entryMatchesSearchFunction · 0.85
StringInterface · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…