USACE / USACE/groundwork

Solution for Client-Side Routing

Open
#213 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Redux-bundler-hook requires you use

import { useConnect } from "redux-bundler-hook";

In order to expose the hook for connection state and client side routing.

In the past - namely here in the docs - we have said to hijack all click state in order to make sure the browser refreshes.

Due to district issues presented

  • #208

It has become apparent that this breaks the link tags and in some cases can cause duplicate base paths to present.

This appears to not be an issue for websites that do NOT have base paths set and use the root path. i.e A2W, etc.

The solution to #208, before LRE site was pushed to prod, was to remove the global onClick. The same onClick required in the docs (mentioned above). This means the site will no longer do client-side routing and every click is a complete page refresh.

Groundwork CTRL + Click / Link sharing is also broke

If you ctrl + click any of the links on the Groundwork website they also result in a 404. This is most likely because the onClick is hiding the hash route + base URL set in the vite.config.js i.e. (/groundwork)

Ctrl clicking a link from the site results in:
https://usace.github.io/docs/app-shell/site-wrapper

But it should be this, which is handled by the above mentioned onClick dynamically:
https://usace.github.io/groundwork/#/docs/app-shell/site-wrapper

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 with the client-side-routing.jsx documentation example linked in the issue, then inspect vite.config.js and the current routing/link behavior. Reproduce normal clicks and Ctrl-clicks on a site using the /groundwork base path. Done means client-side routing works without breaking link tags, duplicate base paths, or shared links that should retain the hash route.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.