@checkstack/incident-frontend 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @checkstack/incident-frontend
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 208ad71: Centralize realtime cache invalidation: signals now carry their owning `pluginId` end-to-end, and a single `SignalAutoInvalidator` mounted near the React Query client invalidates `[[pluginId]]` for every incoming signal automatically.
|
|
8
|
+
|
|
9
|
+
**Breaking change to `createSignal`** (`@checkstack/signal-common`): the factory now takes a single object argument with `pluginMetadata`, `event`, and `payloadSchema`. The signal id is constructed as `${pluginMetadata.pluginId}.${event}` and the resulting `Signal` carries a `pluginId` field. The `SignalMessage` wire envelope and `ServerToClientMessage` `signal` variant gained a `pluginId` field so the frontend can route invalidations without parsing the id.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// Before
|
|
13
|
+
export const ANOMALY_STATE_CHANGED = createSignal(
|
|
14
|
+
"anomaly.state_changed",
|
|
15
|
+
z.object({ ... }),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// After
|
|
19
|
+
export const ANOMALY_STATE_CHANGED = createSignal({
|
|
20
|
+
pluginMetadata,
|
|
21
|
+
event: "state_changed",
|
|
22
|
+
payloadSchema: z.object({ ... }),
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**New plugin field**: `FrontendPlugin.foreignSignals?: Signal<unknown>[]` lets a plugin opt its `[[pluginId]]` cache into invalidation when another plugin's signal fires (e.g. `dependency-frontend` declares `[SYSTEM_STATUS_CHANGED]` because dependency payloads embed system status). Same-plugin signals must NOT be listed — they are always auto-invalidated.
|
|
27
|
+
|
|
28
|
+
**Removed boilerplate**: per-component `useSignal(X, () => refetch())` and `useSignal(X, () => queryClient.invalidateQueries(...))` calls have been removed across `incident-frontend`, `maintenance-frontend`, `healthcheck-frontend`, `slo-frontend`, `dependency-frontend`, `satellite-frontend`, `announcement-frontend`, `notification-frontend`, and `dashboard-frontend`. The `NotificationBell` unread count is now derived directly from the `getUnreadCount` query (auto-invalidated) instead of a local state mirror.
|
|
29
|
+
|
|
30
|
+
**User-visible bug fix**: the system detail page anomaly widget (`SystemAnomalyWidget`) now updates in real-time when anomalies change, with no per-widget signal subscription required. The dashboard status page also stays fresh on `ANOMALY_STATE_CHANGED`, `ANOMALY_BASELINE_UPDATED`, and `ANOMALY_TREND_DETECTED`.
|
|
31
|
+
|
|
32
|
+
UI-state consumers that legitimately need a `useSignal` (the dashboard activity terminal, the queue lag alert, and the rolling-preset date refresh in `useHealthCheckData`) keep their handlers; the auto-invalidator runs alongside them.
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [208ad71]
|
|
35
|
+
- @checkstack/signal-frontend@0.1.0
|
|
36
|
+
- @checkstack/frontend-api@0.4.0
|
|
37
|
+
- @checkstack/incident-common@0.5.0
|
|
38
|
+
- @checkstack/dashboard-frontend@0.5.1
|
|
39
|
+
- @checkstack/auth-frontend@0.5.31
|
|
40
|
+
- @checkstack/catalog-common@1.5.3
|
|
41
|
+
- @checkstack/ui@1.6.1
|
|
42
|
+
|
|
3
43
|
## 0.6.0
|
|
4
44
|
|
|
5
45
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/incident-frontend",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"checkstack": {
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"lint:code": "eslint . --max-warnings 0"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@checkstack/auth-frontend": "0.5.
|
|
16
|
-
"@checkstack/catalog-common": "1.5.
|
|
17
|
-
"@checkstack/common": "0.
|
|
18
|
-
"@checkstack/dashboard-frontend": "0.
|
|
19
|
-
"@checkstack/frontend-api": "0.3.
|
|
20
|
-
"@checkstack/incident-common": "0.4.
|
|
21
|
-
"@checkstack/signal-frontend": "0.0.
|
|
22
|
-
"@checkstack/ui": "1.
|
|
15
|
+
"@checkstack/auth-frontend": "0.5.30",
|
|
16
|
+
"@checkstack/catalog-common": "1.5.2",
|
|
17
|
+
"@checkstack/common": "0.7.0",
|
|
18
|
+
"@checkstack/dashboard-frontend": "0.5.0",
|
|
19
|
+
"@checkstack/frontend-api": "0.3.11",
|
|
20
|
+
"@checkstack/incident-common": "0.4.9",
|
|
21
|
+
"@checkstack/signal-frontend": "0.0.16",
|
|
22
|
+
"@checkstack/ui": "1.6.0",
|
|
23
23
|
"date-fns": "^4.1.0",
|
|
24
24
|
"lucide-react": "^0.344.0",
|
|
25
25
|
"react": "^18.2.0",
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { usePluginClient, type SlotContext } from "@checkstack/frontend-api";
|
|
3
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
4
3
|
import { SystemStateBadgesSlot } from "@checkstack/catalog-common";
|
|
5
4
|
import { IncidentApi } from "../api";
|
|
6
|
-
import {
|
|
7
|
-
INCIDENT_UPDATED,
|
|
8
|
-
type IncidentWithSystems,
|
|
9
|
-
} from "@checkstack/incident-common";
|
|
5
|
+
import { type IncidentWithSystems } from "@checkstack/incident-common";
|
|
10
6
|
import { Badge } from "@checkstack/ui";
|
|
11
7
|
import { useSystemBadgeDataOptional } from "@checkstack/dashboard-frontend";
|
|
12
8
|
|
|
@@ -50,23 +46,15 @@ export const SystemIncidentBadge: React.FC<Props> = ({ system }) => {
|
|
|
50
46
|
: undefined;
|
|
51
47
|
|
|
52
48
|
// Query for incidents if not using provider
|
|
53
|
-
const { data: incidents
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
);
|
|
49
|
+
const { data: incidents } = incidentClient.getIncidentsForSystem.useQuery(
|
|
50
|
+
{ systemId: system?.id ?? "" },
|
|
51
|
+
{ enabled: !badgeData && !!system?.id }
|
|
52
|
+
);
|
|
58
53
|
|
|
59
54
|
const localIncident = incidents
|
|
60
55
|
? getMostSevereIncident(incidents)
|
|
61
56
|
: undefined;
|
|
62
57
|
|
|
63
|
-
// Listen for realtime incident updates (only in fallback mode)
|
|
64
|
-
useSignal(INCIDENT_UPDATED, ({ systemIds }) => {
|
|
65
|
-
if (!badgeData && system?.id && systemIds.includes(system.id)) {
|
|
66
|
-
void refetch();
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
58
|
// Use provider data if available, otherwise use local state
|
|
71
59
|
const activeIncident = badgeData ? providerIncident : localIncident;
|
|
72
60
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Link } from "react-router-dom";
|
|
3
3
|
import { usePluginClient, type SlotContext } from "@checkstack/frontend-api";
|
|
4
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
5
4
|
import { resolveRoute } from "@checkstack/common";
|
|
6
5
|
import { SystemDetailsTopSlot } from "@checkstack/catalog-common";
|
|
7
6
|
import { IncidentApi } from "../api";
|
|
8
7
|
import {
|
|
9
8
|
incidentRoutes,
|
|
10
|
-
INCIDENT_UPDATED,
|
|
11
9
|
type IncidentWithSystems,
|
|
12
10
|
} from "@checkstack/incident-common";
|
|
13
11
|
import { Badge, LoadingSpinner, Button } from "@checkstack/ui";
|
|
@@ -43,21 +41,11 @@ export const SystemIncidentPanel: React.FC<Props> = ({ system }) => {
|
|
|
43
41
|
const incidentClient = usePluginClient(IncidentApi);
|
|
44
42
|
|
|
45
43
|
// Fetch incidents with useQuery
|
|
46
|
-
const {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{ systemId: system?.id ?? "" },
|
|
52
|
-
{ enabled: !!system?.id }
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
// Listen for realtime incident updates
|
|
56
|
-
useSignal(INCIDENT_UPDATED, ({ systemIds }) => {
|
|
57
|
-
if (system?.id && systemIds.includes(system.id)) {
|
|
58
|
-
void refetch();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
44
|
+
const { data: incidents = [], isLoading: loading } =
|
|
45
|
+
incidentClient.getIncidentsForSystem.useQuery(
|
|
46
|
+
{ systemId: system?.id ?? "" },
|
|
47
|
+
{ enabled: !!system?.id }
|
|
48
|
+
);
|
|
61
49
|
|
|
62
50
|
if (loading) {
|
|
63
51
|
return (
|
|
@@ -6,14 +6,9 @@ import {
|
|
|
6
6
|
useApi,
|
|
7
7
|
wrapInSuspense,
|
|
8
8
|
} from "@checkstack/frontend-api";
|
|
9
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
10
9
|
import { resolveRoute, extractErrorMessage} from "@checkstack/common";
|
|
11
10
|
import { IncidentApi } from "../api";
|
|
12
|
-
import {
|
|
13
|
-
incidentRoutes,
|
|
14
|
-
INCIDENT_UPDATED,
|
|
15
|
-
incidentAccess,
|
|
16
|
-
} from "@checkstack/incident-common";
|
|
11
|
+
import { incidentRoutes, incidentAccess } from "@checkstack/incident-common";
|
|
17
12
|
import { CatalogApi } from "@checkstack/catalog-common";
|
|
18
13
|
import {
|
|
19
14
|
Card,
|
|
@@ -77,13 +72,6 @@ const IncidentDetailPageContent: React.FC = () => {
|
|
|
77
72
|
const systems = systemsData?.systems ?? [];
|
|
78
73
|
const loading = incidentLoading || systemsLoading;
|
|
79
74
|
|
|
80
|
-
// Listen for realtime updates
|
|
81
|
-
useSignal(INCIDENT_UPDATED, ({ incidentId: updatedId }) => {
|
|
82
|
-
if (incidentId === updatedId) {
|
|
83
|
-
void refetchIncident();
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
75
|
// Resolve mutation
|
|
88
76
|
const resolveMutation = incidentClient.resolveIncident.useMutation({
|
|
89
77
|
onSuccess: () => {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { useParams, Link, useNavigate } from "react-router-dom";
|
|
3
3
|
import { usePluginClient, wrapInSuspense } from "@checkstack/frontend-api";
|
|
4
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
5
4
|
import { resolveRoute } from "@checkstack/common";
|
|
6
5
|
import { IncidentApi } from "../api";
|
|
7
6
|
import {
|
|
8
7
|
incidentRoutes,
|
|
9
|
-
INCIDENT_UPDATED,
|
|
10
8
|
type IncidentStatus,
|
|
11
9
|
} from "@checkstack/incident-common";
|
|
12
10
|
import { CatalogApi, catalogRoutes } from "@checkstack/catalog-common";
|
|
@@ -27,15 +25,12 @@ const SystemIncidentHistoryPageContent: React.FC = () => {
|
|
|
27
25
|
const incidentClient = usePluginClient(IncidentApi);
|
|
28
26
|
const catalogClient = usePluginClient(CatalogApi);
|
|
29
27
|
|
|
30
|
-
// Fetch incidents with useQuery
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{ systemId, includeResolved: true },
|
|
37
|
-
{ enabled: !!systemId },
|
|
38
|
-
);
|
|
28
|
+
// Fetch incidents with useQuery — kept fresh via SignalAutoInvalidator.
|
|
29
|
+
const { data: incidentsData, isLoading: incidentsLoading } =
|
|
30
|
+
incidentClient.listIncidents.useQuery(
|
|
31
|
+
{ systemId, includeResolved: true },
|
|
32
|
+
{ enabled: !!systemId },
|
|
33
|
+
);
|
|
39
34
|
|
|
40
35
|
// Fetch systems with useQuery
|
|
41
36
|
const { data: systemsData, isLoading: systemsLoading } =
|
|
@@ -46,13 +41,6 @@ const SystemIncidentHistoryPageContent: React.FC = () => {
|
|
|
46
41
|
const system = systems.find((s) => s.id === systemId);
|
|
47
42
|
const loading = incidentsLoading || systemsLoading;
|
|
48
43
|
|
|
49
|
-
// Listen for realtime updates
|
|
50
|
-
useSignal(INCIDENT_UPDATED, ({ systemIds }) => {
|
|
51
|
-
if (systemId && systemIds.includes(systemId)) {
|
|
52
|
-
void refetchIncidents();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
44
|
const getStatusBadge = (status: IncidentStatus) => {
|
|
57
45
|
switch (status) {
|
|
58
46
|
case "investigating": {
|