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

Change from comma-separated query param to repeated query params (refactor 2 in preparation for Typescript). #97

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

ashsny
Copy link
Contributor

@ashsny ashsny commented Dec 28, 2023

The previous state (comma-separated) was troublesome with authors, which always include commas, which led to a bunch of fragile special casing (see #87) and the inability to handle multiple author filters. Alternatives considered were URL encoding everything and using a non-comma separator (using some unreserved char like _, -, or ~). Vue router documentation was not clear w.r.t. the behavior of URL encoding (lots of references to automatic encoding as in here but our commas weren't getting encoded) and this seemed preferable to non-comma separation.

With this change, URLs for multiple authors look like search?publication-author=Adamovich,+Aleksandra+I&publication-author=Shendure,+Jay (note the change from plural to singular, which is more accurate now) which are handled quite nicely by the vue router as arrays. There's a little bit of careful code around parsing, but that's mostly to satisfy typescript.

@ashsny ashsny requested a review from bencap December 28, 2023 18:18
Copy link
Collaborator

@bencap bencap left a comment

Choose a reason for hiding this comment

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

Looks good!

@ashsny ashsny merged commit 858664e into release-2023.5.0 Dec 29, 2023
@ashsny ashsny deleted the ashsny/refactor-searchview-1 branch January 31, 2024 21:08
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