Files
outline/app/components/Sidebar/components/ArchivedCollectionLink.tsx
T
Tom MoorandClaude Fable 5 b17f2611bf chore: React 18 upgrade (#13559)
* React 18 upgrade

* fix: Force synchronous React rendering in server HTML export

React 18 can defer a legacy ReactDOM.render commit when sync work is
queued, leaving exported component nodes empty. Wrap the render in
flushSync, and flush unmount-scheduled passive effects before global
env cleanup so React never runs without a window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor: Move server ComponentView to createRoot

ReactDOM.render and unmountComponentAtNode are removed in React 19.
flushSync around root.render keeps the mount synchronous for the
HTML-export path, which reads the DOM immediately after.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Enable CI

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-03 01:43:47 -04:00

42 lines
1.0 KiB
TypeScript

import type * as React from "react";
import { useState, useCallback } from "react";
import type Collection from "~/models/Collection";
import useStores from "~/hooks/useStores";
import CollectionLink from "./CollectionLink";
type Props = {
/** The archived collection to render. */
collection: Collection;
/** Indentation depth of the row. */
depth?: number;
};
export function ArchivedCollectionLink({ collection, depth = 0 }: Props) {
const { documents } = useStores();
const [expanded, setExpanded] = useState(false);
const handleDisclosureClick = useCallback(
(ev: React.MouseEvent<HTMLElement>) => {
ev.preventDefault();
ev.stopPropagation();
setExpanded((e) => !e);
},
[]
);
const handleClick = useCallback(() => {
setExpanded(true);
}, []);
return (
<CollectionLink
depth={depth}
collection={collection}
expanded={expanded}
activeDocument={documents.active}
onDisclosureClick={handleDisclosureClick}
onClick={handleClick}
/>
);
}