Skip to content

Fix request.path inside with_request_url helper#1463

Merged
joelhawksley merged 2 commits intoViewComponent:mainfrom
franzliedke:fl/test-helpers-query-params
Aug 10, 2022
Merged

Fix request.path inside with_request_url helper#1463
joelhawksley merged 2 commits intoViewComponent:mainfrom
franzliedke:fl/test-helpers-query-params

Conversation

@franzliedke
Copy link
Copy Markdown
Contributor

What are you trying to accomplish?

#with_request_url is great. It was started in #1058, but later #1221
introduced a tiny regression in the parsing of segments.

When using #with_request_url including a query string, the #path
helper would now contain the query string segment, when it should not.
This led to #fullpath having the query string twice.

What approach did you choose and why?

I added regression tests to the existing scenarios and then fixed the parsing to make them pass. :)

Anything you want to highlight for special attention from reviewers?

I love this library. 😍

`#with_request_url` is great. It was started in ViewComponent#1058, but later ViewComponent#1221
introduced a tiny regression in the parsing of segments.

When using `#with_request_url` including a query string, the `#path`
helper would now contain the query string segment, when it should not.
This led to `#fullpath` having the query string twice.

This commit fixes the parsing and amends the test cases to cover this
scenario.
@franzliedke franzliedke requested a review from a team as a code owner August 10, 2022 21:26
@franzliedke
Copy link
Copy Markdown
Contributor Author

If I see things correctly, the failing build seems to also happen in main and originate from #1462.

Copy link
Copy Markdown
Member

@joelhawksley joelhawksley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your wonderful contribution! ❤️

@joelhawksley joelhawksley merged commit 4241a14 into ViewComponent:main Aug 10, 2022
@franzliedke franzliedke deleted the fl/test-helpers-query-params branch August 10, 2022 23:09
claudiob pushed a commit to claudiob/view_component that referenced this pull request Dec 22, 2023
* Fix request.path inside with_request_url helper

`#with_request_url` is great. It was started in ViewComponent#1058, but later ViewComponent#1221
introduced a tiny regression in the parsing of segments.

When using `#with_request_url` including a query string, the `#path`
helper would now contain the query string segment, when it should not.
This led to `#fullpath` having the query string twice.

This commit fixes the parsing and amends the test cases to cover this
scenario.

* Apply suggestions from code review

Co-authored-by: Joel Hawksley <joelhawksley@github.com>
claudiob pushed a commit to claudiob/view_component that referenced this pull request Jan 3, 2024
* Fix request.path inside with_request_url helper

`#with_request_url` is great. It was started in ViewComponent#1058, but later ViewComponent#1221
introduced a tiny regression in the parsing of segments.

When using `#with_request_url` including a query string, the `#path`
helper would now contain the query string segment, when it should not.
This led to `#fullpath` having the query string twice.

This commit fixes the parsing and amends the test cases to cover this
scenario.

* Apply suggestions from code review

Co-authored-by: Joel Hawksley <joelhawksley@github.com>
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

Successfully merging this pull request may close these issues.

2 participants