@growth-operations/ui-shared 1.6.9 → 1.6.11
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/package.json +1 -1
- package/src/alerts/AlertsTab.jsx +18 -3
- package/src/home/InstallProgress.jsx +11 -2
package/package.json
CHANGED
package/src/alerts/AlertsTab.jsx
CHANGED
|
@@ -166,10 +166,25 @@ export function AlertsTab({
|
|
|
166
166
|
|
|
167
167
|
// Optimistically remove a dismissed alert from local state instead of
|
|
168
168
|
// re-fetching the whole list. Keeps the dismiss interaction to a single API
|
|
169
|
-
// call (the dismiss itself).
|
|
169
|
+
// call (the dismiss itself) in the common case. But if removing the row empties
|
|
170
|
+
// the current page while other pages still have alerts, fall back to a fetch so
|
|
171
|
+
// the user isn't stranded on a falsely-empty "No alerts" view: backfill this
|
|
172
|
+
// page, or step back a page if we just cleared the last one.
|
|
170
173
|
const removeAlertLocally = (id) => {
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
const remainingHere = alerts.filter((a) => a.id !== id);
|
|
175
|
+
const newTotal = Math.max(0, total - 1);
|
|
176
|
+
|
|
177
|
+
if (remainingHere.length === 0 && newTotal > 0) {
|
|
178
|
+
// Page emptied but more remain — reload. If this was the last page and it's
|
|
179
|
+
// now gone, step back one; otherwise reload the same page to pull the next
|
|
180
|
+
// page's rows up into it.
|
|
181
|
+
const lastPage = Math.max(1, Math.ceil(newTotal / PAGE_SIZE));
|
|
182
|
+
load(Math.min(page, lastPage), level);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
setAlerts(remainingHere);
|
|
187
|
+
setTotal(newTotal);
|
|
173
188
|
};
|
|
174
189
|
|
|
175
190
|
useEffect(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Flex,
|
|
4
4
|
Tile,
|
|
@@ -30,13 +30,22 @@ import {
|
|
|
30
30
|
// activation Pub/Sub message via an app endpoint). If omitted, the
|
|
31
31
|
// FAILED state still renders guidance, just no button.
|
|
32
32
|
export function InstallProgress({ state, onRetry }) {
|
|
33
|
+
// Clamp the displayed step to be MONOTONIC. A reinstall (re-consent for new
|
|
34
|
+
// scopes) re-runs activation, which resets activation_step to 0 server-side;
|
|
35
|
+
// the poll can catch that reset and the bar would visibly jump backwards
|
|
36
|
+
// (e.g. 37% -> 0% -> 53%). Track the high-water mark per mount so progress
|
|
37
|
+
// only ever moves forward.
|
|
38
|
+
const maxStepSeen = useRef(0);
|
|
39
|
+
|
|
33
40
|
const activation = state?.activation;
|
|
34
41
|
// No activation block => nothing to show (Home's health hero takes over).
|
|
35
42
|
if (!activation) return null;
|
|
36
43
|
|
|
37
44
|
const status = activation.status;
|
|
38
|
-
const
|
|
45
|
+
const rawStep = activation.step ?? 0;
|
|
39
46
|
const total = activation.total ?? 5;
|
|
47
|
+
maxStepSeen.current = Math.max(maxStepSeen.current, rawStep);
|
|
48
|
+
const step = maxStepSeen.current;
|
|
40
49
|
const warnings = activation.warnings ?? [];
|
|
41
50
|
const complete = activation.complete === true || status === "completed";
|
|
42
51
|
|