-
Notifications
You must be signed in to change notification settings - Fork 898
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
Adds query param for version no #4270
Conversation
Just to clarify, are you saying that if the query parameter is not provided then the page is blank? If so we'd have to fix that, as that behavior would be highly undesirable (and confusing for users!) |
Or do you mean if someone does something goofy like |
No if the query parameter is blank / not provided then it will just select master as it did before.
Yes simply a version number that doesn't exist, doesn't have to be goofy, someone could just make a mistake and write a non existent version number and see a blank screen |
I updated the pr description to clarify my point |
Thanks for the clarification! Could you update these changes to account for the invalid version scenario? |
done, added a message in case the request for the configuration fails |
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.
This won't update the query param in the url when the version
changes because of a dropdown selection. It may be nice to have this (maybe in another fix).
if (version.startsWith('v')) return version; | ||
return `v${version}`; | ||
}; | ||
const versionNumber = null !== versionParam ? parseVersionParam(versionParam) : 'master'; |
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.
nit: maybe checking for falsyness (!versionParam
) is better, in case the param looks like ?version=
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.
hmm, semantically the user has provided a version number, an empty string in this case. so the current way clearly separates version not provided case from provided but invalid case.
If its still necessary will use falsy then
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.
yeah but I think it's fair to assume the user didn't intend to specify a particular version since no valid version will be an empty string
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, an empty string may not be a valid version but what about ?version=0.0
or ?version=0n
.
do we also interpret them as having no intention to specify a version.
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.
IIRC URLSearchParams will return strictly null
in the absence of the query param, so I don't want to bikeshed too much on this one.
If anyone's interested in trying to handle the empty string version case then I'd suggest that be done in a follow up
Yes good observation, we would need to bind the selected option with the query parameter. |
Good spot! TBH this is another one I could probably live with deferring to a follow up PR, unless you'd be interested in implementing and would prefer to address that within this PR @aszenz? |
This adds support for using a query parameter for selecting the version no
Catch request exception in case fetching the configuration from the url fails, this can happen either if non existent version number is passed in or because of server issues.
Covers a few common cases in which the version number can be specified.
Thanks, we have to now link both the search term and version no from the ui to the url, so would prefer to think about it in another pr. |
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!
* Adds query param for version no This adds support for using a query parameter for selecting the version no * Adds error handling to configuration request Catch request exception in case fetching the configuration from the url fails, this can happen either if non existent version number is passed in or because of server issues. * Makes version selection better Covers a few common cases in which the version number can be specified.
* Adds query param for version no This adds support for using a query parameter for selecting the version no * Adds error handling to configuration request Catch request exception in case fetching the configuration from the url fails, this can happen either if non existent version number is passed in or because of server issues. * Makes version selection better Covers a few common cases in which the version number can be specified.
* Adds query param for version no This adds support for using a query parameter for selecting the version no * Adds error handling to configuration request Catch request exception in case fetching the configuration from the url fails, this can happen either if non existent version number is passed in or because of server issues. * Makes version selection better Covers a few common cases in which the version number can be specified.
* Adds query param for version no This adds support for using a query parameter for selecting the version no * Adds error handling to configuration request Catch request exception in case fetching the configuration from the url fails, this can happen either if non existent version number is passed in or because of server issues. * Makes version selection better Covers a few common cases in which the version number can be specified.
* Adds query param for version no This adds support for using a query parameter for selecting the version no * Adds error handling to configuration request Catch request exception in case fetching the configuration from the url fails, this can happen either if non existent version number is passed in or because of server issues. * Makes version selection better Covers a few common cases in which the version number can be specified.
backported in #4958 |
Fixes #4260
This adds support for using a query parameter to select the version no.
Note: If the provided version number in the query string cannot be found then the page is shown as blank since the axios get call returns a 404 and isn't being caught. If this is a concern then a proper 404 message can be shown something like
No such version number found
.