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

frontend: replace BrowserRouter with HashRouter #2524

Closed
wants to merge 1 commit into from

Conversation

benma
Copy link
Contributor

@benma benma commented Feb 1, 2024

Using the BrowserRouter is needlessly complicated, we don't need the browser to make a new "request" when we route to a different page. Getting this to work is especially difficult in iOS, where the file path to index.html is loaded in the webview, and routing to e.g. /account-summary' fails because the absolute filepath /account-summary` does not exist and is outside the app folder sandbox.

Using the hash router instead, where the app path is tracked behind the # (e.g. index.html#/account-summary) is more appropriate and easier to handle.

Using the BrowserRouter is needlessly complicated, we don't need the
browser to make a new "request" when we route to a different
page. Getting this to work is especially difficult in iOS, where the
file path to index.html is loaded in the webview, and routing to
e.g. `/account-summary' fails because the absolute filepath
`/account-summary` does not exist and is outside the app folder
sandbox.

Using the hash router instead, where the app path is tracked behind
the `#` (e.g. index.html#/account-summary) is more appropriate and
easier to handle.
@thisconnect
Copy link
Collaborator

cACK

@benma
Copy link
Contributor Author

benma commented Feb 2, 2024

This is a nice change but it destroys allowing requests to third parties based on the current url (e.g. can load moonpay when on buy page, etc.), because with the hash router, the Android webview does not register url changes anymore.

The blocking of external requests can probably be circumvented by potential malware easily enough, so the benefit of doing this blocking while everything on some pages is questionable.

We could simply remove the blocking and proceed with this PR.

We could also abandon this PR, as I figured out how to fix routing on iOS without changing to the HashRouter.

@thisconnect
Copy link
Collaborator

We could also abandon this PR, as I figured out how to fix routing on iOS without changing to the HashRouter.

👍 closing

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