Skip to content

Commit

Permalink
refactor: 💡 force dynamic to prevent prerendering
Browse files Browse the repository at this point in the history
  • Loading branch information
chauduong1192 committed Dec 5, 2024
1 parent 2458596 commit 368cf0f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/generate-daily/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const metadata = {
title: 'Github repositories',
};

export const dynamic = 'force-dynamic';

export default async function GenerateDaily() {
const { data } = await getReposByUser();

Expand Down
6 changes: 6 additions & 0 deletions src/app/repos/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ export const metadata = {
title: 'Github repositories',
};

export const dynamic = 'force-dynamic';

export default async function GithubRepositories() {
const { data: repos } = await getRepos();

if (!repos) {
return null;
}

const renderGitHubList = () => {
if (!repos) {
return <div>Loading...</div>;
Expand Down
4 changes: 3 additions & 1 deletion src/lib/hono/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { hc } from 'hono/client';
import { AppType } from '@/app/api/[...route]/route';
import { ApiError, ApiResponse } from '@/app/api/helpers/response';

export const RPC = hc<AppType>(process.env.API_URL ?? 'http://localhost:3000');
export const RPC = hc<AppType>(
process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:3000',
);

/**
* Fetches data from a remote server using a request function and arguments.
Expand Down

0 comments on commit 368cf0f

Please sign in to comment.