Widget pages rewrite in-page anchor hashes now that the Observations Widget can go on any page
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 54/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- next.js, typescript
- Ambito
- frontend
Direzione di ricerca
Start with src/components/NACWidget/WidgetRouterHandler.client.tsx and inspect how its effect handles hashes that do not match widget routes. Then read the observations router catch-all in afp-public-widgets/src/apps/observations/router/index.js and reproduce the issue with an in-page anchor and starting filters. Done means ordinary anchor hashes remain intact and do not reset the widget filters, while widget-route hashes continue to work.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
WidgetRouterHandler replaces any URL hash it doesn't recognise as a widget route with the widget's starting path. That was harmless on the dedicated widget pages (/observations, /forecasts/avalanche, …), which have no in-page anchors. Since #1375 (Observations Widget block with starting filters, on pages and posts), editors can put the observations widget on any page, post, or home page, and there it breaks ordinary anchors:
- Loading
/about#donateon a page with the widget rewrites the URL to/about#/view/observations, so the anchor is lost from the address bar and from anything the visitor copies or bookmarks. - Clicking an in-page link to
#sectionafter the widget mounts triggers the widget's own hash router. Its catch-all route (/:pathMatch(.*)*inafp-public-widgets/src/apps/observations/router/index.js) redirects to/view/observationsand drops the editor's starting filters, andWidgetRouterHandleralso rewrites the hash.
The browser usually still scrolls to the anchor before the rewrite, so the visible damage is the URL and the widget resetting its filters.
Where
src/components/NACWidget/WidgetRouterHandler.client.tsx: the effect treats every hash that fails the widget page's path matchers as invalid.- The observations widget's catch-all route in
afp-public-widgets.
Possible fix
Only treat hashes that look like widget routes (#/…) as the widget's. Leave any other hash alone in WidgetRouterHandler. The widget's catch-all redirect would still fire on hashchange, so a complete fix may also need a change in afp-public-widgets (e.g. ignore hashes that don't start with /).
Repro
- Add an Observations Widget block to a page that also has a rich-text link to
#some-heading(or load the page with#some-headingin the URL). - Load the page, or click the link.
- The hash becomes
#/view/observationsand the widget's starting filters are gone.
- Lingua principale
- TypeScript
- Stelle
- 6
- Fork
- 2
- Merge medio
- 1g 11h
- PR unite (30g)
- 35
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NWACus/web
-
tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement needs-triage tenant:a3
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
NWACus/web#1190 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NWACus/web#1154 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Media browser returns "Not found" for repositories using the SHA-256 object formatForse già presa @adamchodera l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Follow-ups from #312Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
janhesters/remixcn#318 ·
I maintainer di solito rispondono entro 1 giorno
-
Interceptor LaunchTestProfile.sh: no Windows (Git Bash/MSYS) branch, test profile never launchesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
danielmiessler/LifeOS#3150 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Make the "%" unit spacing the same in the web and in A10Forse già presa @kragent66-glitch l’ha presa oggi. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 commento ·