From 315eed56a7c832fe233b57405288217bfadb0642 Mon Sep 17 00:00:00 2001 From: Misha Holtz <36575242+mnholtz@users.noreply.github.com> Date: Mon, 18 Nov 2024 07:18:36 -0800 Subject: [PATCH] Bugfix: Don't throw error in FormPreview if assetDatabase is not a UUID (#9531) --- .../src/components/formBuilder/widgets/RichTextWidget.tsx | 4 ++-- .../src/components/richTextEditor/RichTextEditor.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.tsx b/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.tsx index 61c19c4654..6b15565abc 100644 --- a/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.tsx +++ b/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.tsx @@ -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 = ({ id, @@ -45,7 +45,7 @@ const RichTextWidget: React.FunctionComponent = ({ onBlur(id, editor.getHTML()); }} editable={!(disabled || readonly)} - assetDatabaseId={validateUUID(database)} + assetDatabaseId={typeof database === "string" && isUUID(database) ? database : null} content={typeof value === "string" ? value : ""} /> ); diff --git a/applications/browser-extension/src/components/richTextEditor/RichTextEditor.tsx b/applications/browser-extension/src/components/richTextEditor/RichTextEditor.tsx index 867cfaa247..2c647c93dd 100644 --- a/applications/browser-extension/src/components/richTextEditor/RichTextEditor.tsx +++ b/applications/browser-extension/src/components/richTextEditor/RichTextEditor.tsx @@ -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 {