Commit 6806fc2
authored
fix(resources): sort folders and resources as one list so pinned items reach the top (#6213)
* fix(resources): stop hoisting folders so pinned items reach the top
Folders and their sibling resources were sorted as two lists and
concatenated folders-first, so a pinned file, table, or knowledge base
could never rank above an unpinned folder — pinning only reordered
within each partition.
Sort them as one list instead: pinned -> sort key -> name, in a shared
`sortResources` comparator. Rows with no value for the active column
(a folder has no row count or token count) sort last in both
directions, and the name tiebreak is never inverted by `desc`.
Also aligns the surfaces that browse the same resources: the mothership
resource trees, the collapsed sidebar flyout (whose nested levels
partitioned folders-first while its own root interleaved), the sidebar
file tree, and the recently-deleted tiebreak.
Files' sort params were nullable only to encode "folders name/asc,
files updated/desc"; with one list that state is gone, so they default
to updated/desc like Tables and Knowledge.
* improvement(resources): prefetch pinned ids and members with the resource lists
Files, Tables, and Knowledge already prefetched their items and folders,
but not the two lists a complete row needs.
Pinned ids are the list's primary sort key now, so a page that painted
before they arrived rendered the whole list in the wrong order and then
visibly re-sorted. Members back the Owner column, which painted empty
and filled in after.
Both now hydrate alongside the lists via `prefetchResourceListChrome`.
Pinned keys move to `hooks/queries/utils/pinned-item-keys` so the server
prefetch can address them without pulling the contracts barrel and the
optimistic-mutation machinery into the route.
* chore(knowledge): drop the dead pre-redesign knowledge base sort
`sortKnowledgeBases` was a second, complete ordering for knowledge bases
(name/createdAt/updatedAt/docCount) left over from the old sort dropdown,
with no consumers since the shared Resource sort menu replaced it — the
kind of duplicate that silently diverges from the page it shadows.
Its `SortOption`/`SortOrder` types and the `SORT_OPTIONS` list that fed
it were dead with it. `utils/sort.ts` now holds only a filter, so it is
renamed to `utils/filter.ts`.
* fix(resources): sort unknown owners last and align the knowledge sort menu
An owner id that resolves to no workspace member renders an empty cell,
but its sort key was `''`, so those rows floated to the TOP of an
ascending Owner sort while every other valueless cell sorted last. They
now key `null` and follow the same nulls-last rule on all three pages.
The Knowledge sort menu also listed Owner after Last Updated while its
column order — and Tables' menu — put Owner before it.
* chore(knowledge): delete the dead base-card grid view
`BaseCard`/`BaseCardSkeleton`/`BaseCardSkeletonGrid` were the pre-redesign
grid-card knowledge base view, kept alive only by the barrel re-export —
no call sites since the Resource list replaced it.
Removing it orphans `components/constants.ts` entirely (its sort types
went with the dead sort; its three class-name constants had no consumers
left), so that goes too.1 parent feaddc4 commit 6806fc2
29 files changed
Lines changed: 1016 additions & 977 deletions
File tree
- .claude/rules
- apps/sim
- app/workspace/[workspaceId]
- components/folders
- files
- home/components/mothership-view/components/add-resource-dropdown
- knowledge
- components
- base-card
- utils
- lib
- settings/components/recently-deleted
- tables
- w/components/sidebar
- components
- file-list
- hooks/queries
- utils
- lib/url-state
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
Lines changed: 134 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments