Commit c60137b
committed
fix: resolve routing for external HTTP links
This fixes an issue where clicking on external links
(like Castarook) in the Banner and Sidebar components resulted in
a 404 error instead of navigating to the external site.
The cause was react-router-dom intercepting the click events on
<Link> components, even for external absolute URLs starting with
http, and attempting to route them internally within the SPA.
To fix this, we updated the components to check if the link starts
with http. If so, a standard, native HTML <a> tag is rendered
instead of a React Router <Link>. This bypasses React Router
and allows the browser to perform a standard page navigation to
the external URL in the same tab.
- Added comments to the source code to explain this logic.
- Bumped patch version in package.json to 0.20.1.1 parent 5682657 commit c60137b
File tree
6 files changed
+110
-89
lines changed- public
- src/components
6 files changed
+110
-89
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments