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 source of URL params #317

Open
Naapperas opened this issue Apr 27, 2023 · 0 comments
Open

Change source of URL params #317

Naapperas opened this issue Apr 27, 2023 · 0 comments
Labels
investigation Investigation work, no implementation P2 Low priority

Comments

@Naapperas
Copy link
Member

Naapperas commented Apr 27, 2023

#251 introduced SearchURLWidget which gives the user the ability to preview and copy the their clipboard their current search link. However, since we are using react-router, perhaps we should use the exported useLocation hook to get the location information instead of relying on browser APIs.

One pro of this solution is that we do not mix APIs (since we are already using react-router) and some weird errors can be avoided since they should be caught upstream by the dependency: #316 had some issues regarding this since window.location became non-assignable (I suspect some changes in some of our test dependencies caused this).

However, one con of this is that tests that somehow exercise the use of the hook need to have access to react-router's internal context through the use of Routers: this pattern is already used in some places, so anyone who looks at this already has some examples of this. One other way of tackling this is to mock the useLocation hook: I did not manage to make this work but I welcome anyone to try. If you do so I also invite whoever takes up on this work to replace the "enclose with Router" test components with the "mock hook" approach.

This issue talked about a lot of possible changes but is mainly related to investigation work and to see what is best for our use case.

@Naapperas Naapperas added P2 Low priority investigation Investigation work, no implementation labels Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigation Investigation work, no implementation P2 Low priority
Projects
None yet
Development

No branches or pull requests

1 participant