@savvifi/meridian-web-react 0.3.1 → 0.3.2
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/pagination.d.ts +2 -0
- package/src/pagination.js +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvifi/meridian-web-react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React adapter for the meridian WebRenderer seam: a kit-agnostic core (MeridianProvider, PanelRenderer, ComponentKit, reactWebRenderer) that renders meridian.ui.v1 PanelDescriptors through a swappable ComponentKit (MUI, shadcn, \u2026). The premium web renderer tier of the meridian renderer family.",
|
|
6
6
|
"publishConfig": {
|
package/src/pagination.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface PagedTable {
|
|
|
34
34
|
goNext: () => void;
|
|
35
35
|
/** Jump to a page (OFFSET only; no-op otherwise). */
|
|
36
36
|
setPage: (page: number) => void;
|
|
37
|
+
/** True when the populate RPC rejected — so the kit shows an error, not "no data". */
|
|
38
|
+
error: boolean;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* Fetch + page a TablePanel's rows through the invoker. CLIENT returns all rows
|
package/src/pagination.js
CHANGED
|
@@ -99,6 +99,7 @@ export function usePagedRows(panel, invoker) {
|
|
|
99
99
|
const [total, setTotal] = useState(undefined);
|
|
100
100
|
const [nextCursor, setNextCursor] = useState(undefined);
|
|
101
101
|
const [loading, setLoading] = useState(Boolean(panel.populate));
|
|
102
|
+
const [error, setError] = useState(false);
|
|
102
103
|
// Reset paging when the panel identity changes.
|
|
103
104
|
useEffect(() => {
|
|
104
105
|
setPageState(0);
|
|
@@ -111,6 +112,7 @@ export function usePagedRows(panel, invoker) {
|
|
|
111
112
|
}
|
|
112
113
|
let cancelled = false;
|
|
113
114
|
setLoading(true);
|
|
115
|
+
setError(false);
|
|
114
116
|
const cursor = mode === PaginationMode.CURSOR ? cursorStack[page] ?? "" : undefined;
|
|
115
117
|
const request = mode === PaginationMode.CLIENT
|
|
116
118
|
? {}
|
|
@@ -126,8 +128,12 @@ export function usePagedRows(panel, invoker) {
|
|
|
126
128
|
setNextCursor(read.nextCursor);
|
|
127
129
|
})
|
|
128
130
|
.catch(() => {
|
|
129
|
-
|
|
131
|
+
// Surface the failure — a table that shows "no data" on a failed fetch is
|
|
132
|
+
// a UI mishap (the user reads it as "there are none").
|
|
133
|
+
if (!cancelled) {
|
|
130
134
|
setRows([]);
|
|
135
|
+
setError(true);
|
|
136
|
+
}
|
|
131
137
|
})
|
|
132
138
|
.finally(() => {
|
|
133
139
|
if (!cancelled)
|
|
@@ -165,5 +171,5 @@ export function usePagedRows(panel, invoker) {
|
|
|
165
171
|
if (mode === PaginationMode.OFFSET)
|
|
166
172
|
setPageState(Math.max(0, target));
|
|
167
173
|
};
|
|
168
|
-
return { mode, pageSize, rows, loading, page, total, hasPrev, hasNext, goNext, goPrev, setPage };
|
|
174
|
+
return { mode, pageSize, rows, loading, error, page, total, hasPrev, hasNext, goNext, goPrev, setPage };
|
|
169
175
|
}
|