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.

Fix/disable no unsafe optional chaining (#25553)

Matri Qi33afa7c84afc
diff --git a/web/.oxlintrc.json b/web/.oxlintrc.json
index 1bfcca58f58..57eddd34fb5 100644
--- a/web/.oxlintrc.json
+++ b/web/.oxlintrc.json
@@ -45,7 +45,7 @@
"no-unassigned-vars": "warn",
"no-unsafe-finally": "warn",
"no-unsafe-negation": "warn",
- "no-unsafe-optional-chaining": "warn",
+ "no-unsafe-optional-chaining": "error",
"no-unused-labels": "warn",
"no-unused-private-class-members": "warn",
"no-unused-vars": "warn",
diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
index 474f99325fb..54de589ed0d 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts
+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
@@ -589,7 +589,7 @@ const formatItem = (
return false
const obj = findExceptVarInObject(isFile ? { ...v, children } : v, filterVar, selector, isFile)
- return obj?.children && ((obj?.children as Var[]).length > 0 || Object.keys((obj?.children as StructuredOutput)?.schema?.properties || {}).length > 0)
+ return hasValidChildren(obj?.children)
}).map((v) => {
const isFile = v.type === VarType.file
@@ -813,7 +813,7 @@ export const getVarType = ({
if (isIterationInnerVar) {
if (valueSelector[1] === 'item') {
const itemType = getIterationItemType({
- valueSelector: (parentNode?.data as any).iterator_selector || [],
+ valueSelector: (parentNode?.data as any)?.iterator_selector || [],
beforeNodesOutputVars,
})
return itemType
@@ -832,7 +832,7 @@ export const getVarType = ({
if (isLoopInnerVar) {
if (valueSelector[1] === 'item') {
const itemType = getLoopItemType({
- valueSelector: (parentNode?.data as any).iterator_selector || [],
+ valueSelector: (parentNode?.data as any)?.iterator_selector || [],
beforeNodesOutputVars,
})
return itemType