Skip to content

fix: wire up close button on Skills detail pane#1685

Open
reverb256 wants to merge 1 commit intoPostHog:mainfrom
reverb256:fix/1649-skills-close-button
Open

fix: wire up close button on Skills detail pane#1685
reverb256 wants to merge 1 commit intoPostHog:mainfrom
reverb256:fix/1649-skills-close-button

Conversation

@reverb256
Copy link
Copy Markdown
Contributor

Problem

The close button (X) on the Skills detail pane does nothing. Clicking it appears to have no effect — the sidebar stays open.

Closes #1649

Root Cause

In SkillsView.tsx, the selectedSkill useMemo returns skills[0] when selectedPath is null. Since the sidebar renders based on !!selectedSkill, it's always true when any skills exist — the close button sets selectedPath to null, but selectedSkill still resolves to the first skill.

Fix

Return null when selectedPath is null instead of falling back to skills[0].

Tests

5 new tests in SkillsView.test.tsx:

  • Sidebar starts closed when no skill is selected
  • Clicking a card opens the detail panel
  • Close button properly closes the detail panel
  • Clicking the same card toggles (deselects)
  • Clicking a different card switches the detail panel

The selectedSkill useMemo returned skills[0] as a fallback when
selectedPath was null, meaning the sidebar never closed because
!!selectedSkill was always true when skills existed.

Changed both fallback returns to null so the sidebar correctly
closes when the close button or card toggle sets selectedPath to null.

Fixes PostHog#1649
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.

Close button on Skills detail pane does not do anything

1 participant