Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions apps/app/src/components/thread/timeline/ExpandableTimelineRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export interface ExpandableTimelineRowProps {
* state until the user toggles the row or the row unmounts.
*/
terminalAutoExpanded?: boolean;
/**
* Seed for the user's manual expand/collapse choice, and where to report
* changes to it. Lets a host that unmounts far-away rows (the windowed
* timeline) restore the choice when the row mounts again; the state itself
* stays local to the row.
*/
initialManualExpansionOverride?: boolean | null;
onManualExpansionOverrideChange?: (override: boolean) => void;
onBeforeExpand?: () => void;
renderBody: () => ReactNode;
title: TimelineTitle;
Expand Down Expand Up @@ -86,8 +94,10 @@ function ExpandableTimelineRowComponent({
expandable = true,
forceExpanded = false,
horizontalPadding = "default",
initialManualExpansionOverride = null,
leadingIcon,
onBeforeExpand,
onManualExpansionOverrideChange,
onTitleAction,
renderBody,
resolveSegmentLinkHref,
Expand All @@ -97,7 +107,7 @@ function ExpandableTimelineRowComponent({
titleContent,
}: ExpandableTimelineRowProps) {
const [manualExpansionOverride, setManualExpansionOverride] =
useState<ManualExpansionOverride>(null);
useState<ManualExpansionOverride>(initialManualExpansionOverride);
const [terminalAutoExpandedLatch, setTerminalAutoExpandedLatch] =
useState(terminalAutoExpanded);
const [collapsedPreviewActive, setCollapsedPreviewActive] = useState(false);
Expand All @@ -123,7 +133,8 @@ function ExpandableTimelineRowComponent({
onBeforeExpand?.();
}
setManualExpansionOverride(!isExpanded);
}, [isExpanded, onBeforeExpand]);
onManualExpansionOverrideChange?.(!isExpanded);
}, [isExpanded, onBeforeExpand, onManualExpansionOverrideChange]);
const handleCollapsedPreviewClick = useCallback(
(event: CollapsedPreviewClickEvent): void => {
if (
Expand Down
Loading