Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
AruSeito committed Mar 4, 2024
2 parents f23ede4 + 7753298 commit 97d65d2
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import IconHotSpot from "@illa-public/icon-hot-spot"
import { ILLA_MIXPANEL_EVENT_TYPE } from "@illa-public/mixpanel-utils"
import { t } from "i18next"
import { FC, memo } from "react"
import { FC, memo, useMemo } from "react"
import { useDispatch, useSelector } from "react-redux"
import { Badge, BugIcon, Trigger, getColor } from "@illa-design/react"
import { isOpenDebugger } from "@/redux/config/configSelector"
Expand All @@ -13,9 +13,18 @@ const DebugButton: FC = () => {
const debuggerData = useSelector(getExecutionError)
const debuggerVisible = useSelector(isOpenDebugger)

const debugMessageNumber = debuggerData
? Object.keys(debuggerData).length
: undefined
const debugMessageNumber = useMemo(() => {
if (debuggerData) {
let count = 0
Object.keys(debuggerData).forEach((errors) => {
if (Array.isArray(debuggerData[errors])) {
count += debuggerData[errors].length
}
})
return count
}
return undefined
}, [debuggerData])
const dispatch = useDispatch()

const handleClickDebuggerIcon = () => {
Expand Down
6 changes: 4 additions & 2 deletions apps/builder/src/page/App/components/Debugger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ export const Debugger: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
<div css={errorContentStyle}>
{Object.keys(debuggerData)?.map((name, index) => {
const error = debuggerData[name]
if (isArray(error)) {

if (isArray(error) && error.length > 0) {
return error?.map((item) => {
return <ErrorItem key={index} pathName={name} item={item} />
})
} else {
return null
}
return <ErrorItem key={name} pathName={name} item={error} />
})}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export const ResizingAndDragContainer: FC<ResizingAndDragContainerProps> = (
return (
keys.length > 0 &&
keys.some((key) => {
return key.startsWith(displayName)
return (
Array.isArray(errors[key]) &&
errors[key].length > 0 &&
key.startsWith(displayName)
)
})
)
}, [displayName, errors])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const WrapperContainer: FC<WrapperContainerProps> = (props) => {
return (
keys.length > 0 &&
keys.some((key) => {
return key.startsWith(displayName)
return (
Array.isArray(errors[key]) &&
errors[key].length > 0 &&
key.startsWith(displayName)
)
})
)
}, [displayName, errors])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export const useScaleStateSelector = (displayName: string) => {
return (
keys.length > 0 &&
keys.some((key) => {
return key.startsWith(displayName)
return (
Array.isArray(errors[key]) &&
errors[key].length > 0 &&
key.startsWith(displayName)
)
})
)
}, [displayName, errors])
Expand Down
20 changes: 11 additions & 9 deletions apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import i18n from "@/i18n/config"
import { getContainerListDisplayNameMappedChildrenNodeDisplayName } from "@/redux/currentApp/components/componentsSelector"
import {
DependenciesState,
ErrorShape,
ExecutionErrorType,
ExecutionState,
} from "@/redux/currentApp/executionTree/executionState"
Expand Down Expand Up @@ -124,7 +123,7 @@ export class ExecutionTreeFactory {
}

validateTree(tree: RawTreeShape) {
const validateErrors: Record<string, any> = klona(this.errorTree)
const validateErrors: Record<string, any> = {}
const validateResultTree = Object.keys(tree).reduce(
(current: RawTreeShape, displayName) => {
const widgetOrAction = current[displayName]
Expand Down Expand Up @@ -555,7 +554,9 @@ export class ExecutionTreeFactory {
)
const { validateErrors, validateResultTree } =
this.validateTree(evaluatedTree)

const mergedError = merge({}, validateErrors, errorTree)

const errorTreeResult = this.mergeErrorTree(
mergedError,
mergedUpdatePathMapAction,
Expand Down Expand Up @@ -717,14 +718,15 @@ export class ExecutionTreeFactory {
set(current, fullPath, evaluateValue)
}
} catch (e) {
const oldError = errorTree[fullPath] ?? ([] as ErrorShape[])
if (Array.isArray(oldError)) {
oldError.push({
errorType: ExecutionErrorType.EVALUATED,
errorMessage: (e as Error).message,
errorName: (e as Error).name,
})
let oldError = errorTree[fullPath]
if (!Array.isArray(oldError)) {
oldError = []
}
oldError.push({
errorType: ExecutionErrorType.EVALUATED,
errorMessage: (e as Error).message,
errorName: (e as Error).name,
})
errorTree[fullPath] = oldError
set(current, fullPath, undefined)
}
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/widgetLibrary/DataGridWidget/dataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export const DataGridWidget: FC<BaseDataGridProps> = (props) => {
},
},
])
triggerEventHandler("onRowClickChange")
triggerEventHandler("onRowClick")
}

const onFilterModelChange = (model: GridFilterModel) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export const DATA_GRID_EVENT_HANDLER_CONFIG: EventHandlerConfig = {
},
{
label: i18n.t(
"editor.inspect.setter_content.widget_action_type_name.onRowClickChange",
"editor.inspect.setter_content.widget_action_type_name.onRowClick",
),
value: "onRowClickChange",
value: "onRowClick",
},
],
methods: [
Expand Down

0 comments on commit 97d65d2

Please sign in to comment.