@checkstack/maintenance-frontend 0.5.7 → 0.5.8
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/maintenance-frontend
|
|
2
2
|
|
|
3
|
+
## 0.5.8
|
|
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/maintenance-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.5.7
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/maintenance-frontend",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
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/maintenance-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/maintenance-common": "0.4.11",
|
|
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 { MaintenanceApi } from "../api";
|
|
6
|
-
import {
|
|
7
|
-
MAINTENANCE_UPDATED,
|
|
8
|
-
type MaintenanceWithSystems,
|
|
9
|
-
} from "@checkstack/maintenance-common";
|
|
5
|
+
import { type MaintenanceWithSystems } from "@checkstack/maintenance-common";
|
|
10
6
|
import { Badge } from "@checkstack/ui";
|
|
11
7
|
import { useSystemBadgeDataOptional } from "@checkstack/dashboard-frontend";
|
|
12
8
|
|
|
@@ -26,20 +22,19 @@ function hasActiveMaintenance(maintenances: MaintenanceWithSystems[]): boolean {
|
|
|
26
22
|
* When rendered within SystemBadgeDataProvider, uses bulk-fetched data.
|
|
27
23
|
* Otherwise, falls back to individual fetch.
|
|
28
24
|
*
|
|
29
|
-
*
|
|
25
|
+
* Realtime updates arrive via the SignalAutoInvalidator (auto-invalidates
|
|
26
|
+
* `[["maintenance"]]` queries when MAINTENANCE_UPDATED fires).
|
|
30
27
|
*/
|
|
31
28
|
export const SystemMaintenanceBadge: React.FC<Props> = ({ system }) => {
|
|
32
29
|
const maintenanceClient = usePluginClient(MaintenanceApi);
|
|
33
30
|
const badgeData = useSystemBadgeDataOptional();
|
|
34
31
|
|
|
35
|
-
// Try to get data from provider first
|
|
36
32
|
const providerData = badgeData?.getSystemBadgeData(system?.id ?? "");
|
|
37
33
|
const providerHasActive = providerData
|
|
38
34
|
? hasActiveMaintenance(providerData.maintenances)
|
|
39
35
|
: false;
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
const { data: maintenances, refetch } =
|
|
37
|
+
const { data: maintenances } =
|
|
43
38
|
maintenanceClient.getMaintenancesForSystem.useQuery(
|
|
44
39
|
{ systemId: system?.id ?? "" },
|
|
45
40
|
{ enabled: !badgeData && !!system?.id }
|
|
@@ -49,14 +44,6 @@ export const SystemMaintenanceBadge: React.FC<Props> = ({ system }) => {
|
|
|
49
44
|
? hasActiveMaintenance(maintenances)
|
|
50
45
|
: false;
|
|
51
46
|
|
|
52
|
-
// Listen for realtime maintenance updates (only in fallback mode)
|
|
53
|
-
useSignal(MAINTENANCE_UPDATED, ({ systemIds }) => {
|
|
54
|
-
if (!badgeData && system?.id && systemIds.includes(system.id)) {
|
|
55
|
-
void refetch();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Use provider data if available, otherwise use local state
|
|
60
47
|
const hasActive = badgeData ? providerHasActive : localHasActive;
|
|
61
48
|
|
|
62
49
|
if (!hasActive) return;
|
|
@@ -1,14 +1,10 @@
|
|
|
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 { SystemDetailsSlot } from "@checkstack/catalog-common";
|
|
7
6
|
import { MaintenanceApi } from "../api";
|
|
8
|
-
import {
|
|
9
|
-
maintenanceRoutes,
|
|
10
|
-
MAINTENANCE_UPDATED,
|
|
11
|
-
} from "@checkstack/maintenance-common";
|
|
7
|
+
import { maintenanceRoutes } from "@checkstack/maintenance-common";
|
|
12
8
|
import { LoadingSpinner, Button } from "@checkstack/ui";
|
|
13
9
|
import { Wrench, History } from "lucide-react";
|
|
14
10
|
|
|
@@ -21,22 +17,12 @@ type Props = SlotContext<typeof SystemDetailsSlot>;
|
|
|
21
17
|
export const SystemMaintenancePanel: React.FC<Props> = ({ system }) => {
|
|
22
18
|
const maintenanceClient = usePluginClient(MaintenanceApi);
|
|
23
19
|
|
|
24
|
-
// Fetch maintenances with useQuery
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{ systemId: system?.id ?? "" },
|
|
31
|
-
{ enabled: !!system?.id }
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// Listen for realtime maintenance updates
|
|
35
|
-
useSignal(MAINTENANCE_UPDATED, ({ systemIds }) => {
|
|
36
|
-
if (system?.id && systemIds.includes(system.id)) {
|
|
37
|
-
void refetch();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
20
|
+
// Fetch maintenances with useQuery — kept fresh via SignalAutoInvalidator.
|
|
21
|
+
const { data: maintenances = [], isLoading: loading } =
|
|
22
|
+
maintenanceClient.getMaintenancesForSystem.useQuery(
|
|
23
|
+
{ systemId: system?.id ?? "" },
|
|
24
|
+
{ enabled: !!system?.id }
|
|
25
|
+
);
|
|
40
26
|
|
|
41
27
|
if (loading) {
|
|
42
28
|
return (
|