Skip to content

armgit / dify

Public Imported from GitHub
0

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.

refactor(web): use Number.isNaN for numeric guards (#42692)

yyhfe09df3afbc5
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 51c00aab7a9..72925020904 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -2236,11 +2236,6 @@
"count": 2
}
},
- "web/app/components/datasets/hit-testing/components/score.tsx": {
- "unicorn/prefer-number-properties": {
- "count": 1
- }
- },
"web/app/components/datasets/list/dataset-card/components/operations-dropdown.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -2434,11 +2429,6 @@
"count": 7
}
},
- "web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx": {
- "unicorn/prefer-number-properties": {
- "count": 2
- }
- },
"web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx": {
"typescript/no-explicit-any": {
"count": 5
@@ -4435,9 +4425,6 @@
"web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx": {
"dify/require-disable-directive-description": {
"count": 2
- },
- "unicorn/prefer-number-properties": {
- "count": 1
}
},
"web/app/components/workflow/run/iteration-log/iteration-result-panel.tsx": {
@@ -4464,11 +4451,6 @@
"count": 2
}
},
- "web/app/components/workflow/run/loop-log/loop-log-trigger.tsx": {
- "unicorn/prefer-number-properties": {
- "count": 1
- }
- },
"web/app/components/workflow/run/loop-log/loop-result-panel.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 2
diff --git a/web/app/components/datasets/hit-testing/components/score.tsx b/web/app/components/datasets/hit-testing/components/score.tsx
index 670fda868d1..ddef36afa95 100644
--- a/web/app/components/datasets/hit-testing/components/score.tsx
+++ b/web/app/components/datasets/hit-testing/components/score.tsx
@@ -9,7 +9,7 @@ type Props = {
}
const Score: FC<Props> = ({ value, besideChunkName }) => {
- if (!value || isNaN(value)) return null
+ if (!value || Number.isNaN(value)) return null
return (
<div
className={cn(
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx
index ba01076aa4b..99556a7550a 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx
@@ -29,11 +29,11 @@ const Input: FC<InputProps> = ({
const toLimit = (v: string) => {
const minNum = Number.parseFloat(`${min}`)
const maxNum = Number.parseFloat(`${max}`)
- if (!isNaN(minNum) && Number.parseFloat(v) < minNum) {
+ if (!Number.isNaN(minNum) && Number.parseFloat(v) < minNum) {
onChange(`${min}`)
return
}
- if (!isNaN(maxNum) && Number.parseFloat(v) > maxNum) onChange(`${max}`)
+ if (!Number.isNaN(maxNum) && Number.parseFloat(v) > maxNum) onChange(`${max}`)
}
return (
diff --git a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx
index 1020a90e9d6..94d34fa0d5c 100644
--- a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx
+++ b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx
@@ -73,7 +73,7 @@ const IterationLogTrigger = ({
if (parallelNodes.length > 0) return parallelNodes
const serialIndex = Number.parseInt(key, 10)
- if (!isNaN(serialIndex)) {
+ if (!Number.isNaN(serialIndex)) {
const serialNodes = allExecutions.filter(
(exec) =>
exec.execution_metadata?.iteration_id === nodeInfo.node_id &&
diff --git a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
index eb1b0928780..420a53fafc0 100644
--- a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
+++ b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
@@ -25,7 +25,7 @@ const LoopLogTrigger = ({ nodeInfo, allExecutions, onShowLoopResultList }: LoopL
if (parallelNodes.length > 0) return parallelNodes
const serialIndex = Number.parseInt(key, 10)
- if (!isNaN(serialIndex)) {
+ if (!Number.isNaN(serialIndex)) {
const serialNodes = allExecutions.filter(
(exec) =>
exec.execution_metadata?.loop_id === nodeInfo.node_id &&