Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
antonmoiseev opened this issue Sep 22, 2024 · 6 comments
Open
1 task done
Assignees
Labels
bug/confirmed We have confirmed this is a bug topic/router-&-navigation

Comments

@antonmoiseev
Copy link
Contributor

antonmoiseev commented Sep 22, 2024

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?

  • I'm interested in working on this
@antonmoiseev antonmoiseev added the bug/needs-info More information is needed for reproduction label Sep 22, 2024
@antonmoiseev antonmoiseev changed the title [Bug?]: [Bug?]: Generated named routes do not filter out undefined values from query params Sep 22, 2024
@Josh-Walker-GM Josh-Walker-GM added bug/confirmed We have confirmed this is a bug and removed bug/needs-info More information is needed for reproduction labels Sep 24, 2024
@Josh-Walker-GM Josh-Walker-GM self-assigned this Sep 24, 2024
@Josh-Walker-GM Josh-Walker-GM changed the title [Bug?]: Generated named routes do not filter out undefined values from query params [Bug]: Generated named routes do not filter out undefined values from query params Sep 24, 2024
@Josh-Walker-GM
Copy link
Collaborator

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
Copy link
Contributor Author

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
Copy link
Collaborator

Perfect if you need anything just let me know!

@antonmoiseev
Copy link
Contributor Author

@Josh-Walker-GM linking the PR here - #11635

@Josh-Walker-GM
Copy link
Collaborator

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug topic/router-&-navigation
Projects
Status: Backlog
Development

No branches or pull requests

2 participants