fix: nested var ref

This commit is contained in:
yashsinghcodes
2025-12-04 14:11:01 +05:30
parent cfc7da0abb
commit eccfe01fba
+15 -11
View File
@@ -18,7 +18,7 @@ import {
Collapse, Collapse,
} from '@mui/material'; } from '@mui/material';
import { Context } from '../context/ContextApi.jsx'; import { Context } from '../context/ContextApi.jsx';
import {getTheme} from '../theme.jsx'; import { getTheme } from '../theme.jsx';
import Checkbox from '@mui/material/Checkbox'; import Checkbox from '@mui/material/Checkbox';
import { isMobile } from "react-device-detect" import { isMobile } from "react-device-detect"
import { NestedMenuItem } from "mui-nested-menu" import { NestedMenuItem } from "mui-nested-menu"
@@ -179,7 +179,7 @@ const CodeEditor = (props) => {
const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata); const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata);
// const {codelang, setcodelang} = props // const {codelang, setcodelang} = props
const {themeMode, supportEmail} = useContext(Context) const { themeMode, supportEmail } = useContext(Context)
const theme = getTheme(themeMode) const theme = getTheme(themeMode)
const [validation, setValidation] = React.useState(false); const [validation, setValidation] = React.useState(false);
@@ -972,7 +972,11 @@ const CodeEditor = (props) => {
// Resolve the child paths/variables first, // Resolve the child paths/variables first,
// So that "$a.b.c" is handled before "$a.b" and then "$a" // So that "$a.b.c" is handled before "$a.b" and then "$a"
// Replace "$parent.child" before "$parent" so "$parent.child" doesn't become "parentValue.child" (which can't be matched later). // Replace "$parent.child" before "$parent" so "$parent.child" doesn't become "parentValue.child" (which can't be matched later).
found.sort((a, b) => b.length - a.length) console.log("FOUND PROD BEFORE SORT:", found)
found.sort((a, b) => {
return Number(b.length) - Number(a.length)
})
console.log("FOUND PROD AFTER SORT:", found)
//console.log("FOUND: ", found) //console.log("FOUND: ", found)
try { try {
@@ -1480,11 +1484,11 @@ const CodeEditor = (props) => {
} }
// Int // Int
const lineposition = parseInt(usedposition/lineheight) const lineposition = parseInt(usedposition / lineheight)
// Find the correct line // Find the correct line
if (lineposition > codedatasplit.length) { if (lineposition > codedatasplit.length) {
codedatasplit[codedatasplit.length-1] += value codedatasplit[codedatasplit.length - 1] += value
} else { } else {
codedatasplit[lineposition] += value codedatasplit[lineposition] += value
} }
@@ -1513,7 +1517,7 @@ const CodeEditor = (props) => {
cursor: dragging ? "grabbing" : "grab", cursor: dragging ? "grabbing" : "grab",
minWidth: 100, minWidth: 100,
border: "1px solid rgba(255,255,255,0.5)", border: "1px solid rgba(255,255,255,0.5)",
borderRadius: theme.palette.borderRadius/2, borderRadius: theme.palette.borderRadius / 2,
marginRight: 10, marginRight: 10,
padding: 5, padding: 5,
}} }}
@@ -1585,7 +1589,7 @@ const CodeEditor = (props) => {
return ( return (
<div style={{minHeight: 40, marginTop: 10, }}> <div style={{ minHeight: 40, marginTop: 10, }}>
<div style={{ <div style={{
cursor: "pointer", cursor: "pointer",
display: "flex", display: "flex",
@@ -1594,7 +1598,7 @@ const CodeEditor = (props) => {
setExpanded(!expanded) setExpanded(!expanded)
}}> }}>
<ValueBox name={innerdata?.name} value={innerdata?.value} /> <ValueBox name={innerdata?.name} value={innerdata?.value} />
<Typography style={{marginTop: 5, maxWidth: 150, maxHeight: 40, overflow: "hidden", }}> <Typography style={{ marginTop: 5, maxWidth: 150, maxHeight: 40, overflow: "hidden", }}>
{innerdata?.name} {innerdata?.name}
</Typography> </Typography>
</div> </div>
@@ -2487,7 +2491,7 @@ const CodeEditor = (props) => {
> >
<div> <div>
{actionId === null && triggerId === null ? {actionId === null && triggerId === null ?
<div style={{display: "flex", alignItems: "center"}}> <div style={{ display: "flex", alignItems: "center" }}>
{`Condition ${selectedEdge?.conditions?.findIndex(cond => cond.condition.id === conditionId) + 1 || "0"}`} {`Condition ${selectedEdge?.conditions?.findIndex(cond => cond.condition.id === conditionId) + 1 || "0"}`}
{/* Source node image */} {/* Source node image */}
{selectedEdge?.source ? {selectedEdge?.source ?
@@ -2592,7 +2596,7 @@ const CodeEditor = (props) => {
<span> <span>
<PlayArrowIcon style={{ height: 18, width: 18, marginBottom: -4, marginLeft: 5, }} /> <PlayArrowIcon style={{ height: 18, width: 18, marginBottom: -4, marginLeft: 5, }} />
{selectedAction === undefined ? <Typography style={{color: "inherit"}}>Try it</Typography> : selectedAction.name === "execute_python" ? "Run Python Code" : selectedAction.name === "execute_bash" ? "Run Bash" : "Try it"} {selectedAction === undefined ? <Typography style={{ color: "inherit" }}>Try it</Typography> : selectedAction.name === "execute_python" ? "Run Python Code" : selectedAction.name === "execute_bash" ? "Run Bash" : "Try it"}
<span <span
style={{ style={{
color: "#C8C8C8", color: "#C8C8C8",
@@ -2602,7 +2606,7 @@ const CodeEditor = (props) => {
marginRight: 10, marginRight: 10,
}} }}
> >
<kbd>Ctrl</kbd> + <kbd><KeyboardReturnIcon style={{width: 13, position: "absolute", marginLeft: 3, top: 5, }}/></kbd> <kbd>Ctrl</kbd> + <kbd><KeyboardReturnIcon style={{ width: 13, position: "absolute", marginLeft: 3, top: 5, }} /></kbd>
</span> </span>
</span> </span>