redwoodjs / redwood

The App Framework for Startups
https://redwoodjs.com
MIT License
17.16k stars 982 forks source link

[Bug]: Generated named routes do not filter out undefined values from query params #11598

Open antonmoiseev opened 5 days ago

antonmoiseev commented 5 days ago

What's not working?

Functions generated for named routes, do not filter out query string params with undefined values. They do so for path params , but not for query.

How do we reproduce the bug?

Assuming you have a Redwood app with "home" route. Pass any args to the generated routes.home() function that have undefined value:

// returns following string: "/a=1&b=undefined"
routes.home({ a: 1, b: undefined })

What's your environment? (If it applies)

System:
    OS: macOS 14.5
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - /private/var/folders/fn/l_969nyj4bb2j2qcn8qsw2fw0000gn/T/xfs-072696cd/node
    Yarn: 4.4.1 - /private/var/folders/fn/l_969nyj4bb2j2qcn8qsw2fw0000gn/T/xfs-072696cd/yarn
  Databases:
    SQLite: 3.43.2 - /usr/bin/sqlite3
  Browsers:
    Safari: 17.5
  npmPackages:
    @redwoodjs/core: 8.2.0 => 8.2.0
    @redwoodjs/project-config: 8.2.0 => 8.2.0
    @redwoodjs/realtime: 8.2.0 => 8.2.0
    @redwoodjs/studio: 12.0.0 => 12.0.0

Are you interested in working on this?

Josh-Walker-GM commented 3 days ago

Hey @antonmoiseev! Just confirmed this. I agree it's not exactly what one would expect. To navigate with the real undefined and to get the string "undefined" in the params.

Do you want to implement a fix for this one too? No pressure of course we can add it to our internal list if you don't have the time. Your contributions are awesome and always appreciated!

antonmoiseev commented 3 days ago

I'd be happy to! Spending more time on a Redwood project now, glad to contribute back to the extent of my capacity.

Josh-Walker-GM commented 3 days ago

Perfect if you need anything just let me know!

antonmoiseev commented 3 days ago

@Josh-Walker-GM linking the PR here - https://github.com/redwoodjs/redwood/pull/11635

Josh-Walker-GM commented 3 days ago

Awesome! Feel free to request a review or otherwise ping me once you're happy with it and I can review and get it in.

antonmoiseev commented 3 days ago

It's ready, please review whenever you have a chance