@checkstack/ui 0.0.2 → 0.0.3

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,27 @@
1
1
  # @checkstack/ui
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - cb82e4d: Improved `counter` and `pie` auto-chart types to show frequency distributions instead of just the latest value. Both chart types now count occurrences of each unique value across all runs/buckets, making them more intuitive for visualizing data like HTTP status codes.
8
+
9
+ Changed HTTP health check chart annotations: `statusCode` now uses `pie` chart (distribution view), `contentType` now uses `counter` chart (frequency count).
10
+
11
+ Fixed scrollbar hopping when health check signals update the accordion content. All charts now update silently without layout shift or loading state flicker.
12
+
13
+ Refactored health check visualization architecture:
14
+
15
+ - `HealthCheckStatusTimeline` and `HealthCheckLatencyChart` now accept `HealthCheckDiagramSlotContext` directly, handling data transformation internally
16
+ - `HealthCheckDiagram` refactored to accept context from parent, ensuring all visualizations share the same data source and update together on signals
17
+ - `HealthCheckSystemOverview` simplified to use `useHealthCheckData` hook for consolidated data fetching with automatic signal-driven refresh
18
+
19
+ Added `silentRefetch()` method to `usePagination` hook for background data refreshes without showing loading indicators.
20
+
21
+ Fixed `useSignal` hook to use a ref pattern internally, preventing stale closure issues. Callbacks now always access the latest values without requiring manual memoization or refs in consumer components.
22
+
23
+ Added signal handling to `useHealthCheckData` hook for automatic chart refresh when health check runs complete.
24
+
3
25
  ## 0.0.2
4
26
 
5
27
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/ui",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "dependencies": {
@@ -76,8 +76,10 @@ export interface PaginationState {
76
76
  nextPage: () => void;
77
77
  /** Go to previous page */
78
78
  prevPage: () => void;
79
- /** Refresh current page */
79
+ /** Refresh current page (shows loading state) */
80
80
  refetch: () => void;
81
+ /** Refresh current page silently (no loading state, prevents UI flicker) */
82
+ silentRefetch: () => void;
81
83
  }
82
84
 
83
85
  /**
@@ -153,33 +155,38 @@ export function usePagination<TResponse, TItem, TExtraParams = object>({
153
155
  [extraParams]
154
156
  );
155
157
 
156
- const fetchData = useCallback(async () => {
157
- setLoading(true);
158
- setError(undefined);
159
-
160
- try {
161
- const offset = (page - 1) * limit;
162
- const params = {
163
- limit,
164
- offset,
165
- ...extraParamsRef.current,
166
- } as PaginationParams & TExtraParams;
167
-
168
- const response = await fetchFnRef.current(params);
169
- setItems(getItemsRef.current(response));
170
- setTotal(getTotalRef.current(response));
171
- } catch (error_) {
172
- setError(error_ instanceof Error ? error_ : new Error(String(error_)));
173
- setItems([]);
174
- } finally {
175
- setLoading(false);
176
- }
177
- }, [page, limit, extraParamsKey]);
158
+ const fetchData = useCallback(
159
+ async (showLoading = true) => {
160
+ if (showLoading) {
161
+ setLoading(true);
162
+ }
163
+ setError(undefined);
164
+
165
+ try {
166
+ const offset = (page - 1) * limit;
167
+ const params = {
168
+ limit,
169
+ offset,
170
+ ...extraParamsRef.current,
171
+ } as PaginationParams & TExtraParams;
172
+
173
+ const response = await fetchFnRef.current(params);
174
+ setItems(getItemsRef.current(response));
175
+ setTotal(getTotalRef.current(response));
176
+ } catch (error_) {
177
+ setError(error_ instanceof Error ? error_ : new Error(String(error_)));
178
+ setItems([]);
179
+ } finally {
180
+ setLoading(false);
181
+ }
182
+ },
183
+ [page, limit, extraParamsKey]
184
+ );
178
185
 
179
186
  // Fetch on mount and when dependencies change
180
187
  useEffect(() => {
181
188
  if (fetchOnMount || page !== defaultPage || limit !== defaultLimit) {
182
- void fetchData();
189
+ void fetchData(true);
183
190
  }
184
191
  }, [fetchData, fetchOnMount, page, limit, defaultPage, defaultLimit]);
185
192
 
@@ -213,6 +220,14 @@ export function usePagination<TResponse, TItem, TExtraParams = object>({
213
220
  }
214
221
  }, [hasPrev]);
215
222
 
223
+ const refetch = useCallback(() => {
224
+ void fetchData(true);
225
+ }, [fetchData]);
226
+
227
+ const silentRefetch = useCallback(() => {
228
+ void fetchData(false);
229
+ }, [fetchData]);
230
+
216
231
  const pagination: PaginationState = {
217
232
  page,
218
233
  limit,
@@ -224,7 +239,8 @@ export function usePagination<TResponse, TItem, TExtraParams = object>({
224
239
  setLimit,
225
240
  nextPage,
226
241
  prevPage,
227
- refetch: fetchData,
242
+ refetch,
243
+ silentRefetch,
228
244
  };
229
245
 
230
246
  return { items, loading, error, pagination };