Commit ed6f691
authored
[CRCR] Fix client-side crash on CRCR pages after idle (#8341)
## Summary
All three CRCR pages (`/crcr`, `/crcr/[org]/[repo]`, `/crcr/metrics`)
use the bare `fetcher` from `GeneralUtils`, which calls `res.json()`
without checking `res.ok`. When SWR auto-revalidates and the API returns
a non-200 response (e.g. ClickHouse timeout, 502), the error object is
treated as valid data. This causes a `TypeError` when the code tries to
iterate over undefined fields (e.g. `allowlist["L4"]` on `{ error: "..."
}`), crashing the page with "Application error: a client-side exception
has occurred".
**Fix**: Switch all CRCR SWR calls from `fetcher` to
`fetcherHandleError`, which throws on non-200 responses so SWR captures
it as `error` and displays the error message gracefully instead of
crashing.
## Test plan
- [ ] Open `/crcr` and leave it idle for several minutes — verify no
crash
- [ ] Verify `/crcr`, `/crcr/pytorch/crcr-test`, and `/crcr/metrics` all
load correctly
- [ ] Simulate a ClickHouse timeout — verify error message is shown
instead of crash1 parent 681b359 commit ed6f691
3 files changed
Lines changed: 13 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
| 473 | + | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
| 546 | + | |
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
772 | | - | |
773 | | - | |
774 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
775 | 777 | | |
776 | 778 | | |
777 | 779 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
355 | | - | |
| 355 | + | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
0 commit comments