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

Array params are lost when constructing URLs #211

Open
sfnelson opened this issue Oct 9, 2024 · 0 comments
Open

Array params are lost when constructing URLs #211

sfnelson opened this issue Oct 9, 2024 · 0 comments

Comments

@sfnelson
Copy link

sfnelson commented Oct 9, 2024

Bug description

When using an asynchronous path that includes array params, the generated URL for pagination converts the key from an array to a single value.

To Reproduce

Steps to reproduce the behavior:

  1. Pass a URL to combobox tag that includes an array param, e.g. countries_path(continents: ["Asia"])
  2. Open the combobox from the frontend
  3. Note that the requested path is /countries?continents[]=Asia
  4. Countries controller generates options via helpers.hw_async_combobox_options(countries, next_page: 2)
  5. See that the requested URL for pagination is /countries?continents=Asia&page=2

Expected behavior

The requested URL for pagination should be /countries?continents[]=Asia&page=2

Version Numbers

HotwireCombobox info

  • Gem version: v0.3.2

Context

Pagy gem demonstrates an alternative way of safely constructing URLs using Rack::Utils.build_nested_query that might be helpful. See https://github.com/ddnexus/pagy/blob/master/gem/lib/pagy/url_helpers.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant