Skip to content

feat(nav): hide contexts into a collapsed group#3476

Closed
mayteio wants to merge 3 commits into
mainfrom
posthog-code/hide-contexts
Closed

feat(nav): hide contexts into a collapsed group#3476
mayteio wants to merge 3 commits into
mainfrom
posthog-code/hide-contexts

Conversation

@mayteio

@mayteio mayteio commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Problem

The Contexts explorer gets crowded in a large org — there's a lot in there and no way to tuck away contexts you don't care about. You can star the ones you use most, but everything else sits in one long list.

image

Changes

  • Add a Hide context / Unhide context action to each context's three-dot dropdown and right-click menu, mirroring the existing Star action (single source of truth so both menus stay in lockstep).
  • Hidden contexts leave the starred and main lists and collapse into a Hidden group pinned at the bottom of the sidebar, collapsed by default with a count.
  • Hidden state persists per-user via desktop file-system shortcuts (a distinct hidden-folder shortcut type), reusing the shared shortcuts query so stars and hides don't double-fetch. Deleting a context clears any stale hidden marker, same as it does for stars.

How did you test this?

  • Added useChannelHides.test.tsx (map / hide / unhide), mirroring the stars hook tests.
  • Ran the canvas test suite (vitest run src/features/canvas) — 95 passing.
  • pnpm --filter @posthog/ui typecheck, @posthog/shared typecheck, and Biome check all clean.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Add a "Hide context" action to each context's three-dot / right-click menu in
the Contexts explorer, mirroring "Star context". Hidden contexts drop out of the
starred and main lists and collapse into a "Hidden" group at the bottom of the
sidebar (collapsed by default).

Hidden state persists per-user via desktop file-system shortcuts (a distinct
"hidden-folder" shortcut type), reusing the shared shortcuts query so stars and
hides don't double-fetch.

Generated-By: PostHog Code
Task-Id: 4c16844c-acc9-4124-909d-f07335710a91
@trunk-io

trunk-io Bot commented Jul 15, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 5bc73ea.

@mayteio mayteio changed the title feat(canvas): hide contexts into a collapsed group feat(nav): hide contexts into a collapsed group Jul 15, 2026
@mayteio mayteio requested a review from a team July 15, 2026 14:25
@mayteio mayteio marked this pull request as ready for review July 15, 2026 14:25
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. packages/ui/src/features/canvas/components/ChannelsList.tsx, line 586 (link)

    P1 Shortcut Counts Track Before Loading

    The effect waits only for the channels query. If channels resolve before the independent shortcuts query, the empty shortcut maps make this one-shot event record both starred_count and hidden_count as zero, and viewedTrackedRef prevents correction when the shortcuts arrive.

Reviews (1): Last reviewed commit: "feat(canvas): hide contexts into a colla..." | Re-trigger Greptile

Comment thread packages/ui/src/features/canvas/hooks/useChannelHides.ts
Comment thread packages/ui/src/features/canvas/hooks/useChannelHides.ts
mayteio added 2 commits July 15, 2026 15:30
CHANNELS_SPACE_VIEWED is a one-shot event gated only on the channels query. The
stars/hides shortcuts query is independent, so if channels resolved first the
event recorded starred_count and hidden_count as zero and viewedTrackedRef
blocked any correction. Gate the effect on the shortcut queries' loading state
too. Addresses Greptile P1.

Generated-By: PostHog Code
Task-Id: 4c16844c-acc9-4124-909d-f07335710a91
Two Greptile findings on the hide hook, both inherited from the star hook, so
fix them symmetrically:

- Ignore toggle re-clicks while a create/delete is in flight. The cache only
  updates on success, so a quick double-tap fired two creates for the same path,
  leaving a duplicate shortcut that a single later toggle couldn't clear.
- Swallow failures in the delete-on-channel-delete cleanup so a rejected request
  doesn't surface as an unhandled promise rejection.

Generated-By: PostHog Code
Task-Id: 4c16844c-acc9-4124-909d-f07335710a91
@mayteio mayteio marked this pull request as draft July 15, 2026 18:11
@mayteio mayteio closed this Jul 15, 2026
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