-
Notifications
You must be signed in to change notification settings - Fork 10.4k
fix NavLink with query string can't be selected correctly #32168
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
Conversation
2449934
to
0228e04
Compare
Thanks for proposing this, @ElderJames! There are still some details that would need to be worked out before we could make a change like this.
If you're interested in proceeding with this, could you make a proposal for how to handle the back-compatibility concern? We can then come to an agreement about that. Once that's resolved and an E2E test is added, it's likely we can take this change. Thanks very much! |
Hello. I see that you've just added |
Hello. I see that you've just added |
Hello. I see that you've just added |
Thank you for your reply @SteveSandersonMS . I think adding a |
Hi @ElderJames. |
@ElderJames If you're interested in implementing the proposed design, including tests, please let us know. Otherwise the bot will soon close this PR. |
Sorry, I was on vacation these days. I will continue to finish this feature. |
@ElderJames Thanks for following up. The build is failing at the moment since a new public API was added that is not tracked in the text files that we include in the repo. If you're developing in VS, there is a built-in Roslyn analyzer that you can use to automatically update the text files by right clicking on the warning under the defined symbol. You can also add the type definition at the end of https://github.com/dotnet/aspnetcore/blob/28acd06c02924b2b9ee20748bf7e38847c94f0c4/src/Components/Web/src/PublicAPI.Unshipped.txt. |
No need to rush! Even if the bot closes the PR it can always be reopened. |
Sorry, I don't really understand how to write this test.😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments inline.
With regard to how to write tests, you can leverage our end-to-end testing infrastructure. We have a BasicTestApp
that contains a few components with scenarios used for testing.
For your PR, the component you'll want to use is https://github.com/dotnet/aspnetcore/blob/fdabaf00a6720d852ec3120b7bbe4b14de2f3ccf/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor.
You'll want to add a new NavLink
component to that that sets the new parameter.
We exercise that component from Selenium-based tests. For your scenario, the relevant tests are in https://github.com/dotnet/aspnetcore/blob/fdabaf00a6720d852ec3120b7bbe4b14de2f3ccf/src/Components/test/E2ETest/Tests/RoutingTest.cs.
Let me know if you have any other questions!
@@ -173,6 +181,9 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) | |||
private string? CombineWithSpace(string? str1, string str2) | |||
=> str1 == null ? str2 : $"{str1} {str2}"; | |||
|
|||
private string RemoveQueryString(string path) | |||
=> path.Split('?')[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be a little bit more defensive here can we check to see if the string contains a ?
character first and then produce a substring only if it does?
Co-authored-by: Safia Abdalla <safia@safia.rocks>
Hi @ElderJames. |
Don't close this bug. It's an ugly one. Please solve it. |
Hi @PaulSinnema. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
PR Title
Summary of the changes (Less than 80 chars)
Remove query string when handling path matching.
PR Description
Detail 1
Detail 2
Addresses #bugnumber (in this specific format)
fixed #31312