mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-23 04:09:49 +00:00
fix: React hooks - variable declaration order and lazy initialization (#1017)
- Fixed variable declaration order in CLIToolsPageClient.js (functions before useEffect) - Added lazy initialization for useState in BasicChatPageClient.js to read from localStorage - Reduced ESLint errors by ~23% Co-authored-by: yuangejiaozhu <leegajone@email.com>
This commit is contained in:
@@ -24,13 +24,6 @@ export default function CLIToolsPageClient({ machineId }) {
|
||||
const [apiKeys, setApiKeys] = useState([]);
|
||||
const [toolStatuses, setToolStatuses] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
fetchConnections();
|
||||
loadCloudSettings();
|
||||
fetchApiKeys();
|
||||
fetchAllStatuses();
|
||||
}, []);
|
||||
|
||||
const fetchAllStatuses = async () => {
|
||||
try {
|
||||
const res = await fetch(ALL_STATUSES_URL);
|
||||
@@ -88,6 +81,13 @@ export default function CLIToolsPageClient({ machineId }) {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchConnections();
|
||||
loadCloudSettings();
|
||||
fetchApiKeys();
|
||||
fetchAllStatuses();
|
||||
}, []);
|
||||
|
||||
const getActiveProviders = () => connections.filter(c => c.isActive !== false);
|
||||
|
||||
const getAllAvailableModels = () => {
|
||||
|
||||
Reference in New Issue
Block a user