删除所有console.log输出,优化评查结果的表格的显示,添加新的页码获取逻辑
This commit is contained in:
+7
-7
@@ -1,5 +1,5 @@
|
||||
// import React from 'react';
|
||||
import { type MetaFunction, type LoaderFunctionArgs, redirect } from "@remix-run/node";
|
||||
import { type MetaFunction } from "@remix-run/node";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { Card } from "~/components/ui/Card";
|
||||
import { Button } from "~/components/ui/Button";
|
||||
@@ -43,7 +43,7 @@ export const meta: MetaFunction = () => {
|
||||
// }
|
||||
|
||||
// 添加认证检查
|
||||
export async function loader({ request }: LoaderFunctionArgs) {
|
||||
export async function loader() {
|
||||
// 检查用户登录状态
|
||||
// const { isAuthenticated } = await getUserSession(request);
|
||||
|
||||
@@ -65,11 +65,11 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
return Response.json({ error: responseDocuments.error }, { status: responseDocuments.status || 500 });
|
||||
}
|
||||
const recentFiles = responseDocuments.data?.documents || [];
|
||||
console.log("recentFiles-------",recentFiles);
|
||||
// console.log("recentFiles-------",recentFiles);
|
||||
|
||||
|
||||
const homeData = await getHomeData();
|
||||
console.log("homeData-------",homeData);
|
||||
// console.log("homeData-------",homeData);
|
||||
|
||||
|
||||
return Response.json({ homeData, recentFiles });
|
||||
@@ -125,7 +125,7 @@ export default function Home() {
|
||||
order: 'updated_at.desc'
|
||||
};
|
||||
|
||||
console.log('定时获取最新文档数据...');
|
||||
// console.log('定时获取最新文档数据...');
|
||||
const responseDocuments = await getDocuments(documentSearchParams);
|
||||
|
||||
if (responseDocuments.error) {
|
||||
@@ -138,7 +138,7 @@ export default function Home() {
|
||||
|
||||
// 检查数据是否有变化
|
||||
if (JSON.stringify(newRecentFiles) !== JSON.stringify(recentFiles)) {
|
||||
console.log('文档数据已更新,直接更新状态');
|
||||
// console.log('文档数据已更新,直接更新状态');
|
||||
// 直接更新状态,不需要刷新页面
|
||||
setRecentFiles(newRecentFiles);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export default function Home() {
|
||||
|
||||
// 组件卸载时清除定时器
|
||||
return () => {
|
||||
console.log('清除文档数据自动更新定时器');
|
||||
// console.log('清除文档数据自动更新定时器');
|
||||
clearInterval(timerID);
|
||||
};
|
||||
}, []); // 不再依赖recentFiles,避免循环依赖
|
||||
|
||||
Reference in New Issue
Block a user