-
Notifications
You must be signed in to change notification settings - Fork 92
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
Dynamically add stable or experimental labels to Interop Dashboard URLs #3287
Conversation
} | ||
|
||
if (stable) { | ||
testsURL += '&label=stable'; |
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.
I would assume that ? delimiter is always present in the testURL, e.g. /results/ vs /results/? /results/&label=stable would fail here
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.
Yes, these are always wpt.fyi paths to test results pages with an interop label, so the query string should always already be present
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.
Another way would be:
const url = new URL(testsURL);
url.searchParams.set('label', stable ? 'stable' : 'experimental');
return url.toString();
This works regardless of what the query string is initially.
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.
After trying this, I think using the URL object might not work in our specific case because we allow for multiples of the same query string parameter (e.g. multiple "label" params). Using the set
method might overwrite a &label=master
search param.
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.
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.
Thanks for the example @jcscottiii 🙂 I agree that it would be nice to have another method that allows for multiples of the same search param.
Would you suggest updating the implementation to match? Or do you think the current implementation is fine?
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.
I would update the implementation to match. I like @foolip's suggestion because search parameter modification shouldn't be something we deal with manually if we can avoid it.
I did some searching to make sure we weren't the only ones looking for this same solution.
You should put a TODO note that it could be simplified and add these three links:
- URLSearchParams append/set: variadic values argument? whatwg/url#762
- URLSearchParams.appendAll(iterable) whatwg/url#461
- URLSearchParams delete all vs delete one whatwg/url#335
Any of those would help simplify the code a little bit.
Co-authored-by: Kyle Ju <[email protected]>
Thanks for addressing the comments! |
Fixes #3286
This change adds the stable or experimental labels to test results links on the Interop dashboard based on the view that the user is viewing. Previously, the "experimental" label was used for all links, even when viewing stable data.