Skip to content

Commit

Permalink
Bugfix: Don't throw error in FormPreview if assetDatabase is not a UU…
Browse files Browse the repository at this point in the history
…ID (#9531)
  • Loading branch information
mnholtz authored Nov 18, 2024
1 parent 9231596 commit 315eed5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import React from "react";
import { type WidgetProps } from "@rjsf/utils";
import RichTextEditor from "@/components/richTextEditor/RichTextEditor";
import { validateUUID } from "@/types/helpers";
import {isUUID} from "@/types/helpers";

const RichTextWidget: React.FunctionComponent<WidgetProps> = ({
id,
Expand All @@ -45,7 +45,7 @@ const RichTextWidget: React.FunctionComponent<WidgetProps> = ({
onBlur(id, editor.getHTML());
}}
editable={!(disabled || readonly)}
assetDatabaseId={validateUUID(database)}
assetDatabaseId={typeof database === "string" && isUUID(database) ? database : null}
content={typeof value === "string" ? value : ""}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import ErrorToast from "@/components/richTextEditor/ErrorToast";

type EditorProps = EditorProviderProps & {
// A PixieBrix asset database ID to use for uploading images. If not included, the image extension will be disabled.
assetDatabaseId?: UUID;
assetDatabaseId?: UUID | null;
};

interface ImageWithAssetDatabaseOptions extends ImageOptions {
Expand Down

0 comments on commit 315eed5

Please sign in to comment.