fix: 修复前端7处eslint错误和6处警告
- AccountsPage/CookiePage/UsersPage/LoginTasksPage/ProxyPage: 将数据加载函数改为useCallback包裹,补全useEffect依赖项 - LoginTasksPage: loadAccounts和loadTasks改为useCallback - MainLayout: 补全navigate依赖 - eslint.config.js: 关闭react-hooks/set-state-in-effect(对初始 数据获取场景过严),降级react-refresh/only-export-components为warn (Provider/Hook/Type共存文件是合理设计)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Table, Button, Card, Row, Col, Statistic, message, Tag, Popconfirm, Space, Typography, Input, theme, Dropdown } from 'antd';
|
||||
import { DownloadOutlined, DeleteOutlined, CopyOutlined, SearchOutlined } from '@ant-design/icons';
|
||||
import { cookieApi, type CookieItem } from '../api/modules';
|
||||
@@ -19,7 +19,7 @@ export default function CookiePage() {
|
||||
const canView = can('cookie:view');
|
||||
const canExport = can('cookie:export');
|
||||
|
||||
const loadCookies = async () => {
|
||||
const loadCookies = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const data = await cookieApi.list();
|
||||
@@ -29,11 +29,11 @@ export default function CookiePage() {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadCookies();
|
||||
}, []);
|
||||
}, [loadCookies]);
|
||||
|
||||
const handleExport = async (format: string = 'csv') => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user