Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(web): avoid setState in website crawler effects (#39237)
Wan Xiankai605c0fe02b85
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.jsonindex 64375380f27..a31eaaeffb4 100644--- a/oxlint-suppressions.json+++ b/oxlint-suppressions.json@@ -2474,9 +2474,6 @@}},"web/app/components/datasets/create/website/firecrawl/index.tsx": {- "eslint-react/set-state-in-effect": {- "count": 1- },"no-console": {"count": 1},@@ -2506,9 +2503,6 @@}},"web/app/components/datasets/create/website/watercrawl/index.tsx": {- "eslint-react/set-state-in-effect": {- "count": 1- },"no-console": {"count": 1},diff --git a/web/app/components/datasets/create/website/firecrawl/index.tsx b/web/app/components/datasets/create/website/firecrawl/index.tsxindex a7a5b3ca4ec..895637761eb 100644--- a/web/app/components/datasets/create/website/firecrawl/index.tsx+++ b/web/app/components/datasets/create/website/firecrawl/index.tsx@@ -33,6 +33,11 @@ const Step = {finished: 'finished',} as consttype Step = (typeof Step)[keyof typeof Step]+const STEP_CONTROL_FOLD_OPTIONS: Record<Step, number> = {+ [Step.init]: 0,+ [Step.running]: 1,+ [Step.finished]: 2,+}type CrawlState = {current: numbertotal: number@@ -57,11 +62,8 @@ const FireCrawl: FC<Props> = ({}) => {const { t } = useTranslation()const [step, setStep] = useState<Step>(Step.init)- const [controlFoldOptions, setControlFoldOptions] = useState<number>(0)+ const controlFoldOptions = STEP_CONTROL_FOLD_OPTIONS[step]const isMountedRef = useRef(true)- useEffect(() => {- if (step !== Step.init) setControlFoldOptions(Date.now())- }, [step])useEffect(() => {return () => {isMountedRef.current = falsediff --git a/web/app/components/datasets/create/website/watercrawl/index.tsx b/web/app/components/datasets/create/website/watercrawl/index.tsxindex 9a4480d4050..e327c839d6b 100644--- a/web/app/components/datasets/create/website/watercrawl/index.tsx+++ b/web/app/components/datasets/create/website/watercrawl/index.tsx@@ -3,7 +3,7 @@ import type { FC } from 'react'import type { CrawlOptions, CrawlResultItem } from '@/models/datasets'import { toast } from '@langgenius/dify-ui/toast'import * as React from 'react'-import { useCallback, useEffect, useState } from 'react'+import { useCallback, useState } from 'react'import { useTranslation } from 'react-i18next'import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants'import { useIntegrationsSetting } from '@/app/components/header/account-setting/use-integrations-setting'@@ -33,6 +33,11 @@ const Step = {finished: 'finished',} as consttype Step = (typeof Step)[keyof typeof Step]+const STEP_CONTROL_FOLD_OPTIONS: Record<Step, number> = {+ [Step.init]: 0,+ [Step.running]: 1,+ [Step.finished]: 2,+}const WaterCrawl: FC<Props> = ({onPreview,checkedCrawlResult,@@ -43,10 +48,7 @@ const WaterCrawl: FC<Props> = ({}) => {const { t } = useTranslation()const [step, setStep] = useState<Step>(Step.init)- const [controlFoldOptions, setControlFoldOptions] = useState<number>(0)- useEffect(() => {- if (step !== Step.init) setControlFoldOptions(Date.now())- }, [step])+ const controlFoldOptions = STEP_CONTROL_FOLD_OPTIONS[step]const openIntegrationsSetting = useIntegrationsSetting()const handleSetting = useCallback(() => {openIntegrationsSetting({