URL parameter defaults to 'undefined' in live app

Hey, I have a page called products. It has a optional URL for the product ID.
I conditionally hide/show the sections depending on if the URL parameter is present.
This worked well in the editor, but when I publish the app to live mode, the URL parameter is defaulting to ‘undefined’, therefore the app thinks it is present (although obviously incorrect).

It looks like this
https://***********.weweb-preview.io/products/undefined

If I try to manually remove the URL parameter, the page doesnt exist.

Anyone knows how to deal with this?

The URL parameters was not meant to be optional :confused:

The way weweb works its not possible for now to have multiple path for a same page. But you can make a feature request so we can work on this.

What you can do is either

  • having 2 distincts pages, one with the parameter and one without the parameter
  • use query parameter instead
1 Like

Ah okay, that makes sense now. Thanks!

You can make a linked section for the common part, so the transition will be seamless and you will not have to maintain two sections :slight_smile:

2 Likes

Just ran into this problem and it’s particularly frustrating because it works fine in the editor but breaks in prod, and there is no warning anywhere that path parameters are not optional.

Using query strings instead should work for my use case but now I have to change a TON of dependencies accordingly. Super annoying!