From f678fdc79c2d2a98e31a8894ca74460e1b86ba9f Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Mon, 22 Sep 2025 17:13:04 -0600 Subject: [PATCH] use a key reset instead --- .../components/ui/report/useReportEditor.tsx | 17 ----------------- .../ReportPageController.tsx | 3 +-- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/apps/web/src/components/ui/report/useReportEditor.tsx b/apps/web/src/components/ui/report/useReportEditor.tsx index c25917fe9..d6e614f4f 100644 --- a/apps/web/src/components/ui/report/useReportEditor.tsx +++ b/apps/web/src/components/ui/report/useReportEditor.tsx @@ -69,7 +69,6 @@ const useEditorServerUpdates = ({ isStreaming: boolean; }) => { const hasInitialized = useRef(false); - const lastValue = useRef(''); const { run: throttleStreamUpdate } = useThrottleFn( (v: string) => { @@ -84,12 +83,6 @@ const useEditorServerUpdates = ({ ); useEffect(() => { - // Reset initialization state if we're switching to a different report content - if (value !== lastValue.current) { - hasInitialized.current = false; - lastValue.current = value || ''; - } - if (editor && isStreaming) { hasInitialized.current = true; throttleStreamUpdate(value); @@ -102,16 +95,6 @@ const useEditorServerUpdates = ({ autoSelect: false, }); }); - } else if (editor && value && !hasInitialized.current && !isEmptyEditor(editor)) { - // Handle case where editor has content but we need to switch to different report - hasInitialized.current = true; - markdownToPlatejs(editor, value).then((elements) => { - editor.tf.reset(); - editor.tf.init({ - value: elements, - autoSelect: false, - }); - }); } else { editor?.getPlugin(StreamContentPlugin)?.api.streamContent.stop(); } diff --git a/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx b/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx index e68fa7971..af5c54c42 100644 --- a/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx +++ b/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx @@ -7,10 +7,8 @@ import DynamicReportEditor from '@/components/ui/report/DynamicReportEditor'; import type { IReportEditor } from '@/components/ui/report/ReportEditor'; import { ReportEditorSkeleton } from '@/components/ui/report/ReportEditorSkeleton'; import type { BusterReportEditor } from '@/components/ui/report/types'; -import { SCROLL_AREA_VIEWPORT_CLASS } from '@/components/ui/scroll-area/ScrollArea'; import { useGetScrollAreaRef } from '@/components/ui/scroll-area/useGetScrollAreaRef'; import { useMemoizedFn } from '@/hooks/useMemoizedFn'; -import { useMount } from '@/hooks/useMount'; import { useEditorContext } from '@/layouts/AssetContainer/ReportAssetContainer'; import { cn } from '@/lib/utils'; import { chatQueryKeys } from '../../api/query_keys/chat'; @@ -95,6 +93,7 @@ export const ReportPageController: React.FC<{ > {report ? (