diff --git a/src/app/(main)/changelog/page.tsx b/src/app/(main)/changelog/page.tsx
index 861735fe65c6..fe8ae4edeb97 100644
--- a/src/app/(main)/changelog/page.tsx
+++ b/src/app/(main)/changelog/page.tsx
@@ -38,6 +38,8 @@ const Page = async () => {
const changelogService = new ChangelogService();
const data = await changelogService.getChangelogIndex();
+ if (!data) return notFound();
+
const ld = ldModule.generate({
description: t('changelog.description', { appName: BRANDING_NAME }),
title: t('changelog.title', { appName: BRANDING_NAME }),
@@ -48,7 +50,7 @@ const Page = async () => {
<>
- {data.map((item) => (
+ {data?.map((item) => (
{
const changelogService = new ChangelogService();
const data = await changelogService.getChangelogIndex();
+ if (!data) return notFound();
+
return (
<>
- {data.map((item) => (
+ {data?.map((item) => (
} key={item.id}>
diff --git a/src/features/ChangelogModal/index.tsx b/src/features/ChangelogModal/index.tsx
index fac8bf59d85a..cc527bdafaa0 100644
--- a/src/features/ChangelogModal/index.tsx
+++ b/src/features/ChangelogModal/index.tsx
@@ -7,11 +7,17 @@ import { memo } from 'react';
import { useGlobalStore } from '@/store/global';
const ChangelogModal = memo<{ currentId?: string }>(({ currentId }) => {
- const latestChangelogId = useGlobalStore((s) => s.status.latestChangelogId);
+ const [latestChangelogId, updateSystemStatus] = useGlobalStore((s) => [
+ s.status.latestChangelogId,
+ s.updateSystemStatus,
+ ]);
const router = useRouter();
useTimeout(() => {
- if (latestChangelogId !== currentId) {
+ if (!currentId) return;
+ if (!latestChangelogId) {
+ updateSystemStatus({ latestChangelogId: currentId });
+ } else if (latestChangelogId !== currentId) {
router.push('/changelog/modal');
}
}, 1000);
diff --git a/src/features/User/UserPanel/useMenu.tsx b/src/features/User/UserPanel/useMenu.tsx
index d3e0f651c1e7..62a9cfffc1e0 100644
--- a/src/features/User/UserPanel/useMenu.tsx
+++ b/src/features/User/UserPanel/useMenu.tsx
@@ -188,7 +188,7 @@ export const useMenu = () => {
{
icon: ,
key: 'changelog',
- label: {t('changelog')},
+ label: {t('changelog')},
},
{
children: [
diff --git a/src/server/services/changelog/index.ts b/src/server/services/changelog/index.ts
index 45e1e2014cad..dd5a464afc37 100644
--- a/src/server/services/changelog/index.ts
+++ b/src/server/services/changelog/index.ts
@@ -54,7 +54,7 @@ export class ChangelogService {
return this.mergeChangelogs(data.cloud, data.community).slice(0, 5);
} catch (e) {
console.error('Error getting changelog lists:', e);
- return false as any;
+ return [];
}
}