Next.js Discord

Discord Forum

following next js learn tutorial why am i getting this warning even though i did everything as ment

Answered
swissbobo posted this in #help-forum
Open in Discord
following next js learn tutorial
why am i getting this warning even though i did everything as mentioned from the site

Its pointing to props.searchParams which not a component
Page (app\dashboard\invoices\page.tsx:17:36)
  15 | }) {
  16 |
> 17 |   const searchParams = await props.searchParams;
     |                                    ^
  18 |   const query = searchParams?.query || '';
  19 |   const currentPage = Number(searchParams?.page) || 1;
  20 |   const totalPages = await fetchInvoicesPages(query);
Error: Route "/dashboard/invoices": Uncached data was accessed outside of <Suspense>. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route
    at Page (app\dashboard\invoices\page.tsx:17:36)
Answered by alfonsüs ardani
the nextjs learn section isn't meant for cacheComponents.
View full answer

11 Replies

can i see your next.config.js?
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
    /* config options here */
    images: {
        remotePatterns: [
            {
                protocol: 'https',
                hostname: 'www.hollywoodreporter.com',
                port: '',
                pathname: '**',
            },
        ],
    },
    cacheComponents: true,
};

export default nextConfig;
yes that will go away, but i was trying to opt in for the cache component
the nextjs learn section isn't meant for cacheComponents.
Answer
thats why you are getting that warning even though you did everything as mentioned from the site
aww okay yes i turned it off and it went
guess i need to read more about cachecomponent then
yes
let me know if you want a quick explanation for cacheComponents
thanks you