Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

error on the transaction page, suggested fix #12

@romeo4934

Description

@romeo4934

The error you're encountering is due to the way the redirect is being handled in the TransactionsPage component. In Next.js, you can't return a redirect object directly from a server component. Instead, you should use the redirect function from next/navigation. Let's modify the code to fix this issue:

file: app/transactions/page.tsx

// ... existing imports ...
import { redirect } from 'next/navigation';

// ... existing code ...

export default async function TransactionsPage({ params, searchParams }: { params: {}; searchParams: { page: string } }) {
  // ... existing code ...

  if (page > totalPages) {
    // Redirect to the last valid page if the requested page is out of range
    redirect(`/transactions?page=${totalPages}`);
  }

  // ... rest of the component code ...
}

// ... rest of the file ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions