From 91fefa0e3756db356b4adb198e90914d66c834bf Mon Sep 17 00:00:00 2001 From: twwu Date: Thu, 5 Jun 2025 15:44:18 +0800 Subject: [PATCH] refactor: improve layout and event handling in Header and FieldItem components --- .../datasets/create/website/base/header.tsx | 30 ++++++++++--------- .../input-field/field-list/field-item.tsx | 6 ++-- .../notion/notion-page-selector.tsx | 11 ++++--- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/web/app/components/datasets/create/website/base/header.tsx b/web/app/components/datasets/create/website/base/header.tsx index 7710d8ada9..963efd1761 100644 --- a/web/app/components/datasets/create/website/base/header.tsx +++ b/web/app/components/datasets/create/website/base/header.tsx @@ -30,21 +30,23 @@ const Header = ({ )}> {title} - {!isInPipeline && ( - + <> + + + )} { + const handleOnClickEdit = useCallback((e: React.MouseEvent) => { + e.stopPropagation() if (readonly) return onClickEdit(payload.variable) }, [onClickEdit, payload.variable, readonly]) - const handleRemove = useCallback(() => { + const handleRemove = useCallback((e: React.MouseEvent) => { + e.stopPropagation() if (readonly) return onRemove(index) }, [index, onRemove, readonly]) diff --git a/web/app/components/rag-pipeline/components/panel/test-run/data-source/notion/notion-page-selector.tsx b/web/app/components/rag-pipeline/components/panel/test-run/data-source/notion/notion-page-selector.tsx index ca79c1a9ed..988b00a337 100644 --- a/web/app/components/rag-pipeline/components/panel/test-run/data-source/notion/notion-page-selector.tsx +++ b/web/app/components/rag-pipeline/components/panel/test-run/data-source/notion/notion-page-selector.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import WorkspaceSelector from '@/app/components/base/notion-page-selector/workspace-selector' -import SearchInput from '@/app/education-apply/search-input' +import SearchInput from '@/app/components/base/notion-page-selector/search-input' import PageSelector from '@/app/components/base/notion-page-selector/page-selector' import type { DataSourceNotionPageMap, DataSourceNotionWorkspace, NotionPage } from '@/models/common' import Header from '@/app/components/datasets/create/website/base/header' @@ -36,12 +36,15 @@ const NotionPageSelector = ({ const getNotionData = useCallback(async () => { if (pipeline_id) { - const notionData = await getNotionPages({ + await getNotionPages({ pipeline_id, node_id: nodeId, inputs: {}, - }) as DataSourceNotionWorkspace[] - setNotionData(notionData) + }, { + onSuccess(notionData) { + setNotionData(notionData as DataSourceNotionWorkspace[]) + }, + }) } }, [getNotionPages, nodeId, pipeline_id])