Skip to content

Fix broken job detail styling on community and author listings - #1

Open
dearrudam wants to merge 2 commits into
openings-dev:mainfrom
dearrudam:main
Open

Fix broken job detail styling on community and author listings#1
dearrudam wants to merge 2 commits into
openings-dev:mainfrom
dearrudam:main

Conversation

@dearrudam

Copy link
Copy Markdown

Summary

Opening a job from a community listing (/communities/[owner]/[name]/) rendered the detail overlay completely unstyled in the static export: the document <head> — stylesheet link and title — was emptied.

Root cause is not in OpportunityDetails or DetailsDialog. Selecting a job only adds ?job=<id> to the URL, but the listing controller pushed that purely client-side state through router.replace(...). On the statically exported dynamic routes (/communities/[owner]/[name], /authors/[handle]) that is a router navigation whose segments are not in the prefetch cache, so Next fetches the full RSC payload (…/vagas/index.txt?job=…&_rsc=…) and applying it replaces the tree, dropping the head produced by the initial HTML. On / the segments are prefetched, so the same code path resolved from cache and never broke — which is why only profile routes showed it.

Filters and job selection are client-side URL state, so they now use the shallow-routing API Next documents for exactly this (window.history.replaceState), which keeps usePathname/useSearchParams in sync without any navigation:

-router.replace(href, { scroll: false });
+window.history.replaceState(null, "", href);

useRouter is no longer needed in the controller, and useUrlSync no longer takes a router. OpportunityDetails mode behavior is untouched.

Type of change

  • Bug fix
  • New source repository
  • Feature
  • Refactor
  • Documentation

Validation

  • npm run lint
  • npm run build
  • Manual checks completed

npm run test:job-header passes. Manually verified against the static export (out/ served over HTTP): job detail opens correctly styled from home, community, and author listings; filters still update the URL (trailing slash preserved) and results; standalone /jobs/[id] unchanged.

Notes

Before / after on the community route:

before

after

dearrudam and others added 2 commits August 30, 2026 03:36
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…-sync

Co-authored-by: Maximillian Arruda <dearrudam@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant