payloadcms / payloadcms/website
Documentation Navigation preferences bug
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 634
- Forks
- 195
- Avg merge
- 11h 43m
- Merged PRs (30d)
- 17
Description
Possibly related PR - https://github.com/payloadcms/website/pull/439
If you navigate directly to a page (e.g. via URL or external navigation), the current nav group is highlighted, but not expanded. The expanded state is determined by the last page you clicked on or navigated to via the nav itself, however arriving at a page through other means results in this buggy state.
The issue seems to be related to the "openTopicPreferences" state in the DocsNavigation component. Claude Code suggested this fix, however it seems it might defeat the entire purpose of the "preferences" idea. Personally, I'd prefer an accurate nav bar over one that remember what I clicked on at 3am this morning.
// src/components/DocsNavigation/index.tsx:56
useEffect(() => {
const preference = window.localStorage.getItem(openTopicsLocalStorageKey)
if (preference) {
const parsedPreference = JSON.parse(preference)
// Ensure the current topic is always included in the open topics
if (!parsedPreference.includes(currentTopic)) {
const updatedPreference = [...parsedPreference, currentTopic]
setOpenTopicPreferences(updatedPreference)
window.localStorage.setItem(openTopicsLocalStorageKey, JSON.stringify(updatedPreference))
} else {
setOpenTopicPreferences(parsedPreference)
}
} else {
setOpenTopicPreferences([currentTopic])
}
}, [currentTopic])
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/components/DocsNavigation/index.tsx, especially the openTopicPreferences state and its localStorage effect. Reproduce the issue by opening a documentation page directly, then compare the behavior and proposed approach with PR #439. Done means the current navigation group is highlighted and expanded without losing the intended preference behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react, typescript
- Domain
- documentation, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100