USACE / USACE/groundwork

onClick / navlinks do no present baseURL to the a tags

Open
#207 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Charles Burg @chb-usace Reported this on 06/16/2025

with:

For the sideBar I have links coded like this:

      {
        id: "ReportsMenu-CrookedRiverLockWaterLevels",
        text: "Crooked River Lock Water Levels",
        href: "/reports/CrookedRiverLockHWL",
      },

If you click on the item you get to the page no issues. The url is as follows:
http://localhost:5173/office/lre/reports/CrookedRiverLockHWL

If you right click and select open in new page or tab, it fails. The url is as follows:
http://localhost:5173/reports/CrookedRiverLockHWL

The the page displays this message:
The server is configured with a public base URL of /office/lre - did you mean to visit /office/lre/reports/CrookedRiverLockHWL instead?

If I add the following to sidebar-links.js:
const BASE_URL = import.meta.env.BASE_URL;

      {
        id: "ReportsMenu-CrookedRiverLockWaterLevels",
        text: "Crooked River Lock Water Levels",
        href: `${BASE_URL}/reports/CrookedRiverLockHWL`,
      },

I get a 404 and this message when clicking on the link:
We cant find a page that matches /office/lre/office/lre/reports/CrookedRiverLockHWL

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting sidebar-links.js and the onClick/navigation handling for links with relative href values. Reproduce both normal clicks and opening a link in a new tab while the application uses the /office/lre base URL; done means both paths resolve correctly without duplicating the base URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.