Commit 936e1ac
authored
fix(knowledge): say what went wrong when a document's chunks fail to load (#6858)
* fix(knowledge): say what went wrong when a document's chunks fail to load
`combinedError = documentError || searchError || initialError` collapsed three
different failures into one, blanked the rows and stripped search, sort and
filter — and said nothing. A failed read rendered as an empty table, which is
the same thing the page shows when a document genuinely has no chunks.
Stripping the search box was the worse half: when it was the *search* that
failed, the control the user needed to clear it was the one that disappeared.
The three are now told apart:
- The document itself failing has no page left to draw, so it gets a full
screen, matching the base page's 'Knowledge base not found' one level up.
It has to run before the editor branches — `selectedChunkId` renders the
chunk editor without checking for a document, so a deep link to a chunk of a
deleted document sat on 'Loading chunk…' forever.
- A failed chunk read keeps the document, so it keeps the chrome and the
controls, and the message goes in the table body through the `emptyState`
slot. Tinted with the error token, because at the weight the empty states use
a failure is indistinguishable from 'nothing here yet'.
- A failed search leaves the loaded chunks intact, so it says the search
failed rather than claiming the chunks could not be loaded.
`searchError` went through `instanceof Error ? .message : null`, so a rejection
that was not an `Error` produced no message and fell back to the silent blank
this commit exists to remove. It uses `getErrorMessage` now, like the chunk
read beside it always did.
Pagination is dropped on a failed read — it was counting pages nothing fetched
— and the action bar reads the same value, so it no longer lifts itself clear
of a bar that is not there.
The not-found screen was about to be copied a second time, so it moves to
`ResourceNotFound` and the base page adopts it.
* fix(knowledge): let a processing document say so, not that it failed
A document that is not `completed` rejects the chunk read by design —
`requireChunkReadable` throws `KnowledgeDocumentNotReadyError` before it queries
anything — so `initialError` is set for every pending, processing or failed
document. Treating that as a load failure put "Couldn't load chunks" over a
document that is simply still working.
`chunkRows` already builds the right row for those states, and it turns out
nothing could ever see it: the old `combinedError` blanked the rows on exactly
the same condition, so "Document processing pending..." has been unreachable
for as long as it has existed. Excluding not-ready documents from `chunkError`
brings the row back and leaves the error state for reads that genuinely failed.1 parent 9864f5c commit 936e1ac
4 files changed
Lines changed: 147 additions & 49 deletions
File tree
- apps/sim/app/workspace/[workspaceId]
- components
- resource
- knowledge/[id]
- [documentId]
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
Lines changed: 27 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 | + | |
Lines changed: 113 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| |||
138 | 146 | | |
139 | 147 | | |
140 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
141 | 184 | | |
142 | 185 | | |
143 | 186 | | |
| |||
242 | 285 | | |
243 | 286 | | |
244 | 287 | | |
245 | | - | |
| 288 | + | |
246 | 289 | | |
247 | 290 | | |
248 | 291 | | |
| |||
334 | 377 | | |
335 | 378 | | |
336 | 379 | | |
337 | | - | |
338 | | - | |
339 | 380 | | |
340 | 381 | | |
341 | 382 | | |
| |||
351 | 392 | | |
352 | 393 | | |
353 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
354 | 406 | | |
355 | 407 | | |
356 | 408 | | |
| |||
533 | 585 | | |
534 | 586 | | |
535 | 587 | | |
536 | | - | |
| 588 | + | |
537 | 589 | | |
538 | 590 | | |
539 | 591 | | |
| |||
572 | 624 | | |
573 | 625 | | |
574 | 626 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
600 | 638 | | |
601 | | - | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
602 | 650 | | |
603 | | - | |
604 | 651 | | |
605 | 652 | | |
606 | 653 | | |
| |||
914 | 961 | | |
915 | 962 | | |
916 | 963 | | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
917 | 970 | | |
918 | 971 | | |
919 | 972 | | |
| |||
1099 | 1152 | | |
1100 | 1153 | | |
1101 | 1154 | | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
1102 | 1170 | | |
1103 | 1171 | | |
1104 | 1172 | | |
| |||
1191 | 1259 | | |
1192 | 1260 | | |
1193 | 1261 | | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
1197 | | - | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
1198 | 1266 | | |
1199 | 1267 | | |
1200 | 1268 | | |
1201 | | - | |
1202 | | - | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
1203 | 1276 | | |
1204 | 1277 | | |
1205 | | - | |
| 1278 | + | |
1206 | 1279 | | |
1207 | 1280 | | |
1208 | 1281 | | |
| |||
1223 | 1296 | | |
1224 | 1297 | | |
1225 | 1298 | | |
1226 | | - | |
| 1299 | + | |
1227 | 1300 | | |
1228 | 1301 | | |
1229 | 1302 | | |
| |||
Lines changed: 6 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
1258 | 1259 | | |
1259 | 1260 | | |
1260 | 1261 | | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
1270 | 1267 | | |
1271 | 1268 | | |
1272 | 1269 | | |
| |||
0 commit comments