Skip to content

Documentation Navigation preferences bug #477

Description

@jmcapra

Possibly related PR - #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.

image

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])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions