You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a reusable parseDecisionNode helper and fallback parsing for manual decisions that may appear on the top-level alert object (not only inside a decisions array), fixing missing entries in Decisions UI and Decisions Analysis. Import jsonparser and set AlertID/CreatedAt appropriately when falling back. Also remove the `?? null` coercion in HubBrowser query to avoid forcing valid responses to null and causing a blank page. Affected files: internal/api/handlers/common.go, internal/api/handlers/dashboard.go, internal/api/handlers/dashboard_analysis.go, web/src/pages/HubBrowser.tsx.
- Outer loop: iterates over top-level array (alerts)
28
+
- Inner loop: iterates over `decisions` field within each alert
29
+
30
+
When `cscli decisions add` creates a manual decision, the top-level JSON entry may have the decision fields directly on the alert object (or the `decisions` sub-array may be structured differently). The nested parser silently skips entries that don't match the expected structure.
Add a fallback: after the nested parsing, check if each top-level item has decision-like fields (type, value, scope) directly on it. If so, extract it as a decision directly.
38
+
39
+
---
40
+
41
+
## Issue 2: Hub Browser Shows Blank Page
42
+
43
+
### Symptoms
44
+
- Hub Browser page loads but displays empty/no items
45
+
- No error shown, just blank content
46
+
47
+
### Root Cause
48
+
49
+
**The `?? null` coercion in the query function converts valid data to null.**
50
+
51
+
In `web/src/pages/HubBrowser.tsx:106`:
52
+
```typescript
53
+
returnresponse.data.data??null
54
+
```
55
+
56
+
The `parseHubItems` function (line 56) treats `null` as "no data":
57
+
```typescript
58
+
if (!data) return { items: EMPTY_HUB_ITEMS, rawParseError: false }
59
+
```
60
+
61
+
The actual issue is likely that `response.data.data` returns `undefined` or the response envelope is structured differently than expected. The `?? null` was added defensively but masks the real problem.
62
+
63
+
The backend `ListHubItems` (hub.go:234) returns:
64
+
```go
65
+
c.JSON(http.StatusOK, models.Response{
66
+
Success: true,
67
+
Data: parsed, // parsed JSON from cscli hub list
68
+
})
69
+
```
70
+
71
+
The frontend accesses `response.data.data` where:
72
+
-`response.data` = the axios response body (the `models.Response` envelope)
73
+
-`response.data.data` = the `Data` field of the envelope
74
+
75
+
If the `cscli hub list -o json` output structure changed, `parsed` could be a different shape than expected.
76
+
77
+
### Files Affected
78
+
-`web/src/pages/HubBrowser.tsx:106` - query function with `?? null`
Remove the `?? null` coercion. The `parseHubItems` function already handles undefined/null/string/object/array cases defensively. The `?? null` just forces the "no data" path unnecessarily.
0 commit comments