Skip to content

Commit 5df453d

Browse files
committed
fix infinite loop when 0 environments
1 parent b4c50b3 commit 5df453d

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

client/packages/lowcoder/src/pages/setting/environments/EnvironmentsList.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from "react";
1+
import React, { useState, useEffect, useRef } from "react";
22
import { Typography, Alert, Input, Button, Space, Empty, Card, Spin, Row, Col, Tooltip, Badge } from "antd";
33
import { SearchOutlined, CloudServerOutlined, SyncOutlined, PlusOutlined} from "@ant-design/icons";
44
import { useHistory } from "react-router-dom";
@@ -29,17 +29,12 @@ const EnvironmentsList: React.FC = () => {
2929
const [searchText, setSearchText] = useState("");
3030
const [isCreateModalVisible, setIsCreateModalVisible] = useState(false);
3131
const [isCreating, setIsCreating] = useState(false);
32+
33+
3234

3335
// Hook for navigation
3436
const history = useHistory();
3537

36-
// Load environments on component mount
37-
useEffect(() => {
38-
// Only fetch if environments are not already loaded
39-
if (environments.length === 0 && !isLoading) {
40-
dispatch(fetchEnvironments());
41-
}
42-
}, [dispatch, environments.length, isLoading]);
4338

4439
// Filter environments based on search text
4540
const filteredEnvironments = environments.filter((env) => {

client/packages/lowcoder/src/redux/selectors/enterpriseSelectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ export const selectUnlicensedEnvironments = (state: AppState) => {
4343

4444
export const selectLicensedEnvironments = (state: AppState) => {
4545
const environments = state.ui.enterprise?.environments ?? [];
46-
return environments.filter(env => env.isLicensed !== false); // licensed or unknown (default to licensed)
46+
return environments.filter(env => env.isLicensed !== false);
4747
};
4848

0 commit comments

Comments
 (0)