Skip to content

feat(core): re-bucket pinned docks into a dedicated ~pinned category#466

Merged
antfu merged 1 commit into
mainfrom
feat/dock-pin-category
Jul 23, 2026
Merged

feat(core): re-bucket pinned docks into a dedicated ~pinned category#466
antfu merged 1 commit into
mainfrom
feat/dock-pin-category

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Description

Reworks the dock pin feature. Previously, pinning a dock only floated it to the top of its existing category bucket — it could never jump ahead of higher-priority categories. Now pinning re-buckets the entry into a dedicated ~pinned category with a strongly-negative order weight (-100000), so pinned entries lead the dock bar ahead of every real category.

The re-bucketing respects the dual role of category:

  • A top-level entry (or a whole group button) pins into the bar-level ~pinned bucket.
  • A grouped member pins into a ~pinned sub-category that leads its own group, staying folded inside the group rather than surfacing on the top-level bar.

~pinned is chosen before the category-hide check and is itself never hideable, so a pinned entry stays visible even when its home category is hidden. Unpinning returns the entry to its home category in its previous position.

The whole feature stays client-side: the ~pinned order is a local override in the sort rather than an edit to the upstream DEFAULT_CATEGORIES_ORDER table (the docksPinned shared-state field is unchanged, so no migration). The old "pinned-first" intra-category tiebreaker is removed since pin now changes the bucket. Docs are updated, including a fix to the defaultOrder description (the code sorts ascending — lower first — not "higher first" as previously documented).

Linked Issues

Additional context

New tests in dock-groups.test.ts cover top-level pin → ~pinned, group-button pin → top-level ~pinned, grouped-member pin → ~pinned sub-category (no bar promotion), the -100000 lead ordering, pin overriding category-hide, and the intra-~pinned sort. pnpm lint && pnpm test && pnpm typecheck && pnpm build all pass.

This PR was created with the help of an agent.

@antfu
antfu merged commit 7ccd698 into main Jul 23, 2026
4 checks passed
@antfu
antfu deleted the feat/dock-pin-category branch July 23, 2026 08:34
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.

2 participants