修复Maximum call stack size exceeded的错误,不使用 ... 数组展开符;删除多余的注释和引用

This commit is contained in:
JIANG
2025-12-19 11:55:33 +08:00
parent ac966242e7
commit 120cfc2cb3
2 changed files with 12 additions and 10 deletions

View File

@@ -359,7 +359,9 @@ const StyleEditorPanel: React.FC<StyleEditorPanelProps> = ({
setJunctionText(property);
setShowJunctionTextLayer(styleConfig.showLabels);
setApplyJunctionStyle(true);
setContourLayerAvailable && setContourLayerAvailable(true);
if (property === "pressure" && setContourLayerAvailable) {
setContourLayerAvailable(true);
}
saveLayerStyle(layerId);
open?.({
type: "success",

View File

@@ -155,7 +155,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
return false;
});
if (uniqueNewData.length > 0) {
setJunctionDataState((prev) => [...prev, ...uniqueNewData]);
setJunctionDataState((prev) => prev.concat(uniqueNewData));
}
};
const setPipeData = (newData: any[]) => {
@@ -168,7 +168,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
return false;
});
if (uniqueNewData.length > 0) {
setPipeDataState((prev) => [...prev, ...uniqueNewData]);
setPipeDataState((prev) => prev.concat(uniqueNewData));
}
};
// 配置地图数据源、图层和样式
@@ -422,7 +422,9 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
const uniqueData = Array.from(data.values());
if (uniqueData.length > 0) {
tileJunctionDataBuffer.current.push(...uniqueData);
uniqueData.forEach((item) =>
tileJunctionDataBuffer.current.push(item)
);
debouncedUpdateData.current();
}
}
@@ -501,7 +503,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
const uniqueData = Array.from(data.values());
if (uniqueData.length > 0) {
tilePipeDataBuffer.current.push(...uniqueData);
uniqueData.forEach((item) => tilePipeDataBuffer.current.push(item));
debouncedUpdateData.current();
}
}
@@ -581,7 +583,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
projection: "EPSG:3857",
}),
// 图层依面、线、点、标注次序添加
layers: [...availableLayers],
layers: availableLayers.slice(),
controls: [],
});
setMap(map);
@@ -816,9 +818,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
pipeText,
contours,
]);
useEffect(() => {
console.log("Contour Layer Available:", isContourLayerAvailable);
}, [isContourLayerAvailable]);
// 控制流动动画开关
useEffect(() => {
if (pipeText === "flow" && currentPipeCalData.length > 0) {
@@ -940,7 +940,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
flowFlag: pipeProperties === "flow" && record.value < 0 ? -1 : 1,
path:
pipeProperties === "flow" && record.value < 0 && p.flowFlag > 0
? [...p.path].reverse()
? p.path.slice().reverse()
: p.path,
// 流量数值
[pipeProperties]: