fix: Crash rendering some document hover previews

This commit is contained in:
Tom Moor
2024-06-25 22:20:33 -04:00
parent d03c7b33d3
commit 6a1a3eee91

View File

@@ -1,7 +1,9 @@
import * as React from "react"; import * as React from "react";
import { richExtensions } from "@shared/editor/nodes";
import { UnfurlResourceType, UnfurlResponse } from "@shared/types"; import { UnfurlResourceType, UnfurlResponse } from "@shared/types";
import Editor from "~/components/Editor"; import Editor from "~/components/Editor";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import ErrorBoundary from "../ErrorBoundary";
import { import {
Preview, Preview,
Title, Title,
@@ -21,20 +23,23 @@ const HoverPreviewDocument = React.forwardRef(function _HoverPreviewDocument(
<Preview to={url}> <Preview to={url}>
<Card ref={ref}> <Card ref={ref}>
<CardContent> <CardContent>
<Flex column gap={2}> <ErrorBoundary showTitle={false} reloadOnChunkMissing={false}>
<Title>{title}</Title> <Flex column gap={2}>
<Info>{lastActivityByViewer}</Info> <Title>{title}</Title>
<Description as="div"> <Info>{lastActivityByViewer}</Info>
<React.Suspense fallback={<div />}> <Description as="div">
<Editor <React.Suspense fallback={<div />}>
key={id} <Editor
defaultValue={summary} key={id}
embedsDisabled extensions={richExtensions}
readOnly defaultValue={summary}
/> embedsDisabled
</React.Suspense> readOnly
</Description> />
</Flex> </React.Suspense>
</Description>
</Flex>
</ErrorBoundary>
</CardContent> </CardContent>
</Card> </Card>
</Preview> </Preview>