Commit c2f04e9
committed
refactor(knowledge): sever the shell's route context, in place
Same ordering that made the table move safe: the behavioural edits land first,
as a diff against files that have not moved.
- `useParams` -> `knowledgeWorkspaceId(source)`. The shell took `workspaceId?`
optionally and fell back to route params, which the page relied on — so the
fallback was load-bearing, and it is what stopped this surface existing more
than once per page.
- `useRouter` -> `onNavigate`. Three pushes: the document detail route, the
post-delete redirect, and the breadcrumb root. The latter two already went
through `hrefFor({ to: 'list' })`; the first now goes through a new
`knowledgeDocumentHref`, which lives in a per-kind module because a document
is not a `ResourceKind` — it has no view, no grants and no share surface, so
it cannot be spelled through `hrefFor({ to: 'resource' })`.
- `useUserPermissionsContext` -> `grants`. 13 reads, including two of the form
`canEdit || isLoading` that gate whether a breadcrumb dropdown renders at all.
Those become `grants.write || !grants.settled` — the exact pattern `settled`
was added for, and without it the caret would have popped in after load
instead of rendering disabled.
Three supporting relocations, all pure moves:
- `knowledge/components/icons` deleted — byte-identical to
`@/components/icons/document-icons`, confirmed with `diff`.
- `use-knowledge-upload` -> `@/hooks/kb/`.
- `useContextMenu` -> `components/anchored-context-menu/`, beside the component
every one of its 13 consumers pairs it with.
Also makes table-view's internal imports absolute. They arrived relative with
the move and I did not rewrite them; log-view and knowledge-view have zero
relative imports, so table-view was the outlier against the rule this PR
documents. (file-view has 83 and is left alone — pre-existing, and not worth
83 files of churn here.)1 parent f3ec1d4 commit c2f04e9
38 files changed
Lines changed: 181 additions & 382 deletions
File tree
- apps/sim
- app/workspace/[workspaceId]
- files
- home/components/mothership-view/components/resource-content
- components/terminal-session
- knowledge
- [id]
- [documentId]
- components
- add-documents-modal
- base-tags-modal
- components
- create-base-modal
- icons
- tables
- w
- [workflowId]/components/terminal
- components/output-panel
- components
- preview/components/preview-editor
- sidebar
- components/workflow-list
- components
- folder-item
- workflow-item
- hooks
- components
- resources/table-view
- components
- column-config-sidebar
- enrichments-sidebar
- new-column-dropdown
- row-modal
- table-grid
- workflow-sidebar
- hooks
- hooks/kb
- resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
273 | 278 | | |
274 | 279 | | |
275 | 280 | | |
| |||
380 | 385 | | |
381 | 386 | | |
382 | 387 | | |
383 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
384 | 391 | | |
385 | 392 | | |
386 | 393 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | | - | |
38 | 39 | | |
39 | | - | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/base-tags-modal/base-tags-modal.tsx
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
Lines changed: 39 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| |||
53 | 51 | | |
54 | 52 | | |
55 | 53 | | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
66 | 78 | | |
67 | 79 | | |
68 | 80 | | |
| |||
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
84 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
85 | 99 | | |
86 | 100 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 101 | + | |
90 | 102 | | |
91 | 103 | | |
92 | 104 | | |
| |||
98 | 110 | | |
99 | 111 | | |
100 | 112 | | |
101 | | - | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| |||
225 | 236 | | |
226 | 237 | | |
227 | 238 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 239 | | |
235 | 240 | | |
236 | 241 | | |
| |||
408 | 413 | | |
409 | 414 | | |
410 | 415 | | |
411 | | - | |
| 416 | + | |
| 417 | + | |
412 | 418 | | |
413 | 419 | | |
414 | 420 | | |
| |||
423 | 429 | | |
424 | 430 | | |
425 | 431 | | |
426 | | - | |
| 432 | + | |
427 | 433 | | |
428 | 434 | | |
429 | 435 | | |
| |||
625 | 631 | | |
626 | 632 | | |
627 | 633 | | |
628 | | - | |
| 634 | + | |
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
| |||
642 | 648 | | |
643 | 649 | | |
644 | 650 | | |
645 | | - | |
| 651 | + | |
646 | 652 | | |
647 | 653 | | |
648 | 654 | | |
649 | 655 | | |
650 | | - | |
| 656 | + | |
651 | 657 | | |
652 | 658 | | |
653 | 659 | | |
654 | 660 | | |
655 | 661 | | |
656 | | - | |
| 662 | + | |
657 | 663 | | |
658 | 664 | | |
659 | 665 | | |
660 | 666 | | |
661 | 667 | | |
662 | | - | |
| 668 | + | |
663 | 669 | | |
664 | 670 | | |
665 | 671 | | |
| |||
669 | 675 | | |
670 | 676 | | |
671 | 677 | | |
672 | | - | |
| 678 | + | |
673 | 679 | | |
674 | 680 | | |
675 | 681 | | |
676 | 682 | | |
677 | | - | |
| 683 | + | |
678 | 684 | | |
679 | 685 | | |
680 | 686 | | |
| |||
741 | 747 | | |
742 | 748 | | |
743 | 749 | | |
744 | | - | |
| 750 | + | |
745 | 751 | | |
746 | 752 | | |
747 | 753 | | |
| |||
915 | 921 | | |
916 | 922 | | |
917 | 923 | | |
918 | | - | |
| 924 | + | |
919 | 925 | | |
920 | 926 | | |
921 | 927 | | |
| |||
964 | 970 | | |
965 | 971 | | |
966 | 972 | | |
967 | | - | |
| 973 | + | |
968 | 974 | | |
969 | 975 | | |
970 | 976 | | |
| |||
976 | 982 | | |
977 | 983 | | |
978 | 984 | | |
979 | | - | |
| 985 | + | |
980 | 986 | | |
981 | | - | |
| 987 | + | |
982 | 988 | | |
983 | 989 | | |
984 | 990 | | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
| 991 | + | |
| 992 | + | |
989 | 993 | | |
990 | 994 | | |
991 | 995 | | |
| |||
Lines changed: 50 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 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments