@checkstack/announcement-frontend 0.2.13 → 0.2.14
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,43 @@
|
|
|
1
1
|
# @checkstack/announcement-frontend
|
|
2
2
|
|
|
3
|
+
## 0.2.14
|
|
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/announcement-common@0.3.0
|
|
38
|
+
- @checkstack/auth-frontend@0.5.31
|
|
39
|
+
- @checkstack/ui@1.6.1
|
|
40
|
+
|
|
3
41
|
## 0.2.13
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/announcement-frontend",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"checkstack": {
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"lint:code": "eslint . --max-warnings 0"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@checkstack/announcement-common": "0.2.
|
|
16
|
-
"@checkstack/auth-frontend": "0.5.
|
|
17
|
-
"@checkstack/common": "0.
|
|
18
|
-
"@checkstack/frontend-api": "0.3.
|
|
19
|
-
"@checkstack/signal-frontend": "0.0.
|
|
20
|
-
"@checkstack/ui": "1.
|
|
15
|
+
"@checkstack/announcement-common": "0.2.2",
|
|
16
|
+
"@checkstack/auth-frontend": "0.5.30",
|
|
17
|
+
"@checkstack/common": "0.7.0",
|
|
18
|
+
"@checkstack/frontend-api": "0.3.11",
|
|
19
|
+
"@checkstack/signal-frontend": "0.0.16",
|
|
20
|
+
"@checkstack/ui": "1.6.0",
|
|
21
21
|
"date-fns": "^4.1.0",
|
|
22
22
|
"lucide-react": "^0.344.0",
|
|
23
23
|
"react": "^18.2.0",
|
|
@@ -2,10 +2,8 @@ import React, { useState, useCallback } from "react";
|
|
|
2
2
|
import { usePluginClient } from "@checkstack/frontend-api";
|
|
3
3
|
import {
|
|
4
4
|
AnnouncementApi,
|
|
5
|
-
ANNOUNCEMENT_UPDATED,
|
|
6
5
|
type Announcement,
|
|
7
6
|
} from "@checkstack/announcement-common";
|
|
8
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
9
7
|
import { MarkdownBlock } from "@checkstack/ui";
|
|
10
8
|
import {
|
|
11
9
|
Info,
|
|
@@ -183,15 +181,7 @@ export const AnnouncementBanner: React.FC = () => {
|
|
|
183
181
|
getLocalDismissedIds(),
|
|
184
182
|
);
|
|
185
183
|
|
|
186
|
-
const { data, isLoading
|
|
187
|
-
announcementClient.getActiveAnnouncements.useQuery();
|
|
188
|
-
|
|
189
|
-
// Refetch own query immediately + invalidate all announcement queries
|
|
190
|
-
// (including the dashboard's includeDismissed variant) for cross-component freshness.
|
|
191
|
-
// oRPC query keys are structured as [[...path], { type, input }].
|
|
192
|
-
useSignal(ANNOUNCEMENT_UPDATED, () => {
|
|
193
|
-
void refetch();
|
|
194
|
-
});
|
|
184
|
+
const { data, isLoading } = announcementClient.getActiveAnnouncements.useQuery();
|
|
195
185
|
|
|
196
186
|
// Server-side dismiss — extract stable mutate function to avoid re-renders
|
|
197
187
|
const { mutate: dismissOnServer } =
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { usePluginClient } from "@checkstack/frontend-api";
|
|
3
|
-
import { AnnouncementApi,
|
|
4
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
3
|
+
import { AnnouncementApi, type Announcement } from "@checkstack/announcement-common";
|
|
5
4
|
import { MarkdownBlock } from "@checkstack/ui";
|
|
6
5
|
import {
|
|
7
6
|
Info,
|
|
@@ -103,16 +102,11 @@ export const DashboardAnnouncements: React.FC = () => {
|
|
|
103
102
|
const announcementClient = usePluginClient(AnnouncementApi);
|
|
104
103
|
|
|
105
104
|
// Always refetch on mount so the dashboard shows fresh data when navigated to.
|
|
106
|
-
//
|
|
107
|
-
const { data, isLoading
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
useSignal(ANNOUNCEMENT_UPDATED, () => {
|
|
114
|
-
void refetch();
|
|
115
|
-
});
|
|
105
|
+
// Realtime updates arrive via SignalAutoInvalidator on `[["announcement"]]`.
|
|
106
|
+
const { data, isLoading } = announcementClient.getActiveAnnouncements.useQuery(
|
|
107
|
+
{ includeDismissed: true },
|
|
108
|
+
{ refetchOnMount: "always" },
|
|
109
|
+
);
|
|
116
110
|
|
|
117
111
|
const dashboardAnnouncements = React.useMemo(() => {
|
|
118
112
|
if (!data?.announcements) return [];
|