seeder-st2110-components 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +13 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -2304,15 +2304,16 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2304
2304
|
const [lanConfigs, setLanConfigs] = useState([]);
|
|
2305
2305
|
const [submitLoading, setSubmitLoading] = useState(false);
|
|
2306
2306
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
2307
|
-
const
|
|
2308
|
-
|
|
2309
|
-
|
|
2307
|
+
const initializationStatus = useRef({
|
|
2308
|
+
hasFetched: false,
|
|
2309
|
+
hasInitialized: false
|
|
2310
|
+
});
|
|
2310
2311
|
useEffect(() => {
|
|
2311
2312
|
if (!open) return;
|
|
2312
2313
|
const fetchData = async () => {
|
|
2313
|
-
if (
|
|
2314
|
+
if (initializationStatus.current.hasFetched) return;
|
|
2314
2315
|
try {
|
|
2315
|
-
|
|
2316
|
+
initializationStatus.current.hasFetched = true;
|
|
2316
2317
|
const promises = [];
|
|
2317
2318
|
if (sections.includes('LAN')) {
|
|
2318
2319
|
promises.push(getLanConfig());
|
|
@@ -2336,6 +2337,7 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2336
2337
|
setIsInitialized(true);
|
|
2337
2338
|
} catch (error) {
|
|
2338
2339
|
console.error('Failed to fetch data:', error);
|
|
2340
|
+
initializationStatus.current.hasFetched = false; // 出错时重置
|
|
2339
2341
|
}
|
|
2340
2342
|
};
|
|
2341
2343
|
fetchData();
|
|
@@ -2348,7 +2350,10 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2348
2350
|
setLanConfigs([]);
|
|
2349
2351
|
setSt2110Interfaces([]);
|
|
2350
2352
|
form.resetFields();
|
|
2351
|
-
|
|
2353
|
+
initializationStatus.current = {
|
|
2354
|
+
hasFetched: false,
|
|
2355
|
+
hasInitialized: false
|
|
2356
|
+
};
|
|
2352
2357
|
}
|
|
2353
2358
|
}, [open, form]);
|
|
2354
2359
|
|
|
@@ -2375,9 +2380,9 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2375
2380
|
|
|
2376
2381
|
// 当初始值准备好后设置表单值
|
|
2377
2382
|
useEffect(() => {
|
|
2378
|
-
if (isInitialized && !
|
|
2383
|
+
if (isInitialized && !initializationStatus.current.hasInitialized) {
|
|
2379
2384
|
form.setFieldsValue(initialValues);
|
|
2380
|
-
|
|
2385
|
+
initializationStatus.current.hasInitialized = true;
|
|
2381
2386
|
}
|
|
2382
2387
|
}, [isInitialized, form, initialValues]);
|
|
2383
2388
|
const handleSuccess = useCallback(async function () {
|