Skip to content

Commit 3d6e9b6

Browse files
authored
fixed aggregations switcher (#8014)
1 parent e83f81c commit 3d6e9b6

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

designer/client/src/components/graph/node-modal/NodeTypeDetailsContent.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ export function useNodeTypeDetailsContentLogic(props: Pick<NodeTypeDetailsConten
7777
const [proxyNode, setProxyNode] = useState(() => adjustNode(node));
7878

7979
useEffect(() => {
80-
setProxyNode((node) => {
80+
setProxyNode((currentNode) => {
8181
const adjustedNode = adjustNode(node);
82-
return isEqual(adjustedNode, node) ? node : adjustedNode;
82+
return isEqual(adjustedNode, currentNode) ? currentNode : adjustedNode;
8383
});
84-
}, [adjustNode]);
84+
}, [adjustNode, node]);
8585

8686
const change = useCallback(
8787
(node: SetStateAction<NodeType>, edges: SetStateAction<Edge[]>) => {

designer/client/src/components/graph/node-modal/editors/field/FieldSwitch.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { css } from "@emotion/css";
2-
import { Box, Tabs, Tab, styled } from "@mui/material";
2+
import { Box, styled, Tab, Tabs } from "@mui/material";
33
import type { ReactNode } from "react";
4-
import React, { useState, useMemo, useCallback } from "react";
4+
import React, { useCallback, useMemo, useState } from "react";
55
import { useTranslation } from "react-i18next";
66

77
import { blendDarken, getBorderColor } from "../../../../../containers/theme/helpers";
@@ -111,14 +111,17 @@ export const FieldSwitch = ({ availableEditors, onValueChange, expressionObj, ch
111111
if (readOnly || !showSwitch || isSingleEditorVisible) {
112112
return <>{typeof children === "function" ? children(selectedEditor) : children}</>;
113113
}
114+
115+
const selectedOption = availableEditorsOptions.find(({ value }) => value === selectedEditor.type);
116+
if (!selectedOption) {
117+
return null;
118+
}
119+
114120
return (
115121
<Box display="block" flexBasis={"60%"} flex={1} width={"100%"}>
116122
<Box display="flex" justifyContent="flex-end">
117123
<Tabs
118-
value={
119-
availableEditorsOptions.find((availableEditorsOption) => availableEditorsOption.value === selectedEditor.type)
120-
?.value
121-
}
124+
value={selectedOption.value}
122125
variant="standard"
123126
scrollButtons="auto"
124127
sx={{

0 commit comments

Comments
 (0)