Skip to content

Commit

Permalink
🐛 fix: refactor dynamic import in RSC (#5434)
Browse files Browse the repository at this point in the history
* refactor

* fix
  • Loading branch information
arvinxx authored Jan 14, 2025
1 parent e65a192 commit 6a663a7
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 57 deletions.
4 changes: 1 addition & 3 deletions src/app/(main)/changelog/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/(main)/chat/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/(main)/chat/settings/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/(main)/discover/(detail)/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/(main)/discover/(list)/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/(main)/discover/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
19 changes: 4 additions & 15 deletions src/app/(main)/discover/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import dynamic from 'next/dynamic';
import { redirect } from 'next/navigation';
import urlJoin from 'url-join';

Expand All @@ -10,20 +9,10 @@ import { translation } from '@/server/translation';
import { PageProps } from '@/types/next';
import { isMobileDevice } from '@/utils/server/responsive';

import { ListLoadingWithoutBanner } from '../components/ListLoading';

const AssistantsResult = dynamic(() => import('./features/AssistantsResult'), {
loading: () => <ListLoadingWithoutBanner />,
});
const PluginsResult = dynamic(() => import('./features/PluginsResult'), {
loading: () => <ListLoadingWithoutBanner />,
});
const ModelsResult = dynamic(() => import('./features/ModelsResult'), {
loading: () => <ListLoadingWithoutBanner />,
});
const ProvidersResult = dynamic(() => import('./features/ProvidersResult'), {
loading: () => <ListLoadingWithoutBanner />,
});
import AssistantsResult from './features/AssistantsResult';
import ModelsResult from './features/ModelsResult';
import PluginsResult from './features/PluginsResult';
import ProvidersResult from './features/ProvidersResult';

type Props = PageProps<
undefined,
Expand Down
4 changes: 1 addition & 3 deletions src/app/(main)/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/(main)/profile/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
10 changes: 1 addition & 9 deletions src/app/(main)/profile/security/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import { Skeleton } from 'antd';
import dynamic from 'next/dynamic';
import { notFound } from 'next/navigation';

import { enableClerk } from '@/const/auth';
import { metadataModule } from '@/server/metadata';
import { translation } from '@/server/translation';
import { isMobileDevice } from '@/utils/server/responsive';

const ClerkProfile = dynamic(() => import('../features/ClerkProfile'), {
loading: () => (
<div style={{ flex: 1 }}>
<Skeleton paragraph={{ rows: 8 }} title={false} />
</div>
),
});
import ClerkProfile from '../features/ClerkProfile';

export const generateMetadata = async () => {
const { t } = await translation('auth');
Expand Down
4 changes: 1 addition & 3 deletions src/app/(main)/repos/[id]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/(main)/settings/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';
4 changes: 1 addition & 3 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import dynamic from 'next/dynamic';

export default dynamic(() => import('@/components/404'));
export { default } from '@/components/404';

0 comments on commit 6a663a7

Please sign in to comment.