urlnext.jsparameters

NextJS passing internal files as URL Params


In my NextJS webapp, I have server component Page that is taking an id as a parameter (route is /basket/[providerId])

I added a log on this providerId, and whenever I call this route, I have 2 logs

The code is pretty straightfoward

'use server'
// imports...

type Props = {
    params: {
        id: string
    }
}
const Page = async ({ params: { id } }: Props) => {
    console.log('🚀 ~ Page ~ id:', id) // This log I'm talking about
    let provider: Provider = null

    const providerRequest = await API.provider.get.fn(null, null, { id: id })

    if (providerRequest.status === 200) {
        provider = await providerRequest.json()
    } else {
        const error = await providerRequest.json()
        console.error(error)
    }

    console.log({ provider, id })

    return (
        <section className="shadow px-4 py-4 bg-white">
            <h1 className="text-xl font-semibold mb-4">My Basket</h1>

            <BasketCheckout provider={provider} />
        </section>
    )
}
export default Page

I'm running under NextJS 14.2.3, which is the latest version the day I'm writing those lines. Also experienced the same before upgrading, under NextJS 14.2.2

Any idea why am I receiving such parameters ? It seems also that it only affects this route, I cannot reproduce elsewhere...


Solution

  • Turns out it was the browser extension "React Developer Tools", when opening the Dev Console, triggering this weird call Just deleting or not opening console makes it fine again Solved