@dloizides/ui-tables 1.14.0 → 1.15.0

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,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.15.0
4
+
5
+ **A re-fetch no longer blanks the grid — the server-paged paging defect.**
6
+
7
+ `DataTable` returned its full-bleed loading state whenever `loading` was true, unconditionally.
8
+ On a server-paged grid that is not a cosmetic flicker, it is the paging bug: clicking **Next**
9
+ replaced the table with "Loading…", so the grid visibly EMPTIED and only refilled once the next
10
+ page arrived. To anyone watching — and to any assertion that samples the rows after the click —
11
+ the grid appeared to page to nothing. The same applied to re-filtering and to any `reload()`.
12
+
13
+ Evidence this was real and not theoretical: against the live AML v2 cases console, the API
14
+ returned a correct, non-overlapping page at `skip=50`, yet the UI rendered **zero** rows after
15
+ Next. The rows were being discarded by this component, not by the query.
16
+
17
+ ### The rule now
18
+
19
+ The state view is reserved for when there is genuinely nothing to show:
20
+
21
+ | `loading` | `rows.length` | Renders |
22
+ |---|---|---|
23
+ | true | 0 | loading state (first load) |
24
+ | false | 0 | empty state |
25
+ | true | > 0 | **the existing rows** (stale for a moment), `aria-busy="true"` |
26
+ | false | > 0 | the rows |
27
+
28
+ Rows that already exist stay on screen and swap when the new page resolves. Because the content
29
+ no longer vanishes, the in-flight fetch is announced explicitly via `aria-busy` on the table
30
+ container rather than being implied by the table's destruction.
31
+
32
+ **Behaviour is unchanged for every first load and every empty result**, which is what keeps this a
33
+ MINOR bump. The only consumers that see a difference are those that were already passing `loading`
34
+ alongside non-empty `rows` — i.e. exactly the ones that were silently blanking.
35
+
36
+ All 266 pre-existing tests pass unmodified; 3 added for the retained-rows / busy / swap contract.
37
+
3
38
  ## 1.14.0
4
39
 
5
40
  **Campaign F2 — the private filter fields are now public, in `@dloizides/ui-forms`.**
package/dist/index.js CHANGED
@@ -861,8 +861,9 @@ function DataTable(props) {
861
861
  );
862
862
  const rowBg = (row, index, key) => interactive && hoveredKey === key ? hoverTint : rowBackground(row, index);
863
863
  const stateView = (label) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.state, o?.state], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [tableStyles.stateText, { color: colors.textSecondary }, o?.stateText], children: label }) }) });
864
- if (loading) return stateView(loadingLabel ?? t(TABLE_I18N.loading));
865
- if (rows.length === 0) return stateView(emptyLabel ?? t(TABLE_I18N.empty));
864
+ if (rows.length === 0) {
865
+ return stateView(loading ? loadingLabel ?? t(TABLE_I18N.loading) : emptyLabel ?? t(TABLE_I18N.empty));
866
+ }
866
867
  const renderRow = (row, key, style) => /* @__PURE__ */ jsxRuntime.jsx(
867
868
  DataTableRow,
868
869
  {
@@ -898,7 +899,7 @@ function DataTable(props) {
898
899
  }
899
900
  );
900
901
  if (stacked) {
901
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: [
902
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, "aria-busy": loading, children: [
902
903
  banner,
903
904
  rows.map((row, i) => {
904
905
  const key = rowKeys[i] ?? keyExtractor(row);
@@ -920,6 +921,7 @@ function DataTable(props) {
920
921
  {
921
922
  style: [tableStyles.wrap, frame, o?.wrap],
922
923
  testID,
924
+ "aria-busy": loading,
923
925
  ...keyboardNavigation ? { role: "grid" } : null,
924
926
  children: [
925
927
  banner,