Skip to content

Commit fc884ca

Browse files
authored
fix: merge List.Item.Detail fragment children into single detail element (#439)
The Ente Auth extension wraps two <List.Item.Detail> components in a React Fragment — one with markdown (seconds remaining) and one with metadata (TOTP codes). Raycast merges these into a single detail view, but SuperCmd rendered them as separate h-full divs inside an overflow-hidden container, clipping the second (TOTP codes). When the detail prop is a Fragment containing List.Item.Detail children, merge their props (markdown, metadata, isLoading) into a single element.
1 parent 185dfdd commit fc884ca

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src/renderer/src/raycast-api/list-runtime.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,28 @@ export function createListRuntime(deps: ListRuntimeDeps) {
386386
const extensionContext = getExtensionContext();
387387
const footerTitle = navigationTitle || extInfo.extensionDisplayName || extensionContext.extensionDisplayName || extensionContext.extensionName || 'Extension';
388388
const footerIcon = extInfo.extensionIconDataUrl || extensionContext.extensionIconDataUrl;
389-
const detailElement = selectedItem?.props?.detail;
389+
const rawDetail = selectedItem?.props?.detail;
390+
const detailElement = useMemo(() => {
391+
if (!rawDetail || !React.isValidElement(rawDetail)) return rawDetail;
392+
if (rawDetail.type !== React.Fragment) return rawDetail;
393+
const children = React.Children.toArray(rawDetail.props.children);
394+
let mergedMarkdown: string | undefined;
395+
let mergedMetadata: React.ReactElement | undefined;
396+
let mergedIsLoading: boolean | undefined;
397+
for (const child of children) {
398+
if (!React.isValidElement(child)) continue;
399+
if ((child.type as any) !== ListItemDetail) continue;
400+
if (child.props.markdown !== undefined) mergedMarkdown = child.props.markdown;
401+
if (child.props.metadata !== undefined) mergedMetadata = child.props.metadata;
402+
if (child.props.isLoading !== undefined) mergedIsLoading = child.props.isLoading;
403+
}
404+
if (mergedMarkdown === undefined && mergedMetadata === undefined) return rawDetail;
405+
return React.createElement(ListItemDetail, {
406+
markdown: mergedMarkdown,
407+
metadata: mergedMetadata,
408+
isLoading: mergedIsLoading,
409+
});
410+
}, [rawDetail]);
390411

391412
const listContent = (
392413
<div ref={listRef} className="flex-1 overflow-y-auto py-0">

0 commit comments

Comments
 (0)