@antelopejs/dms 0.20.8-next.926.gdaa3203 → 0.20.8-next.927.g74fccd4
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/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +12 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableListData.ts +30 -8
- package/package.json +2 -2
|
@@ -120,7 +120,7 @@ export function useTableViewListState<T extends Data>(
|
|
|
120
120
|
isSelfManaged: isActiveDisplaySelfManaged,
|
|
121
121
|
heldQuery: liveHold.heldQuery,
|
|
122
122
|
});
|
|
123
|
-
const { data, status, error } = listData;
|
|
123
|
+
const { data, status, error, readOrder } = listData;
|
|
124
124
|
const refresh: typeof listData.refresh = (...args) =>
|
|
125
125
|
listData.refresh(...args);
|
|
126
126
|
|
|
@@ -173,6 +173,7 @@ export function useTableViewListState<T extends Data>(
|
|
|
173
173
|
shownData,
|
|
174
174
|
isFirstPageLoading,
|
|
175
175
|
listNotFound,
|
|
176
|
+
readOrder,
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
179
|
|
|
@@ -21,7 +21,7 @@ export function useTableViewRowRealtime<T extends Data>(
|
|
|
21
21
|
REALTIME_PRESENCE_TOPIC_PREFIX,
|
|
22
22
|
} = scope.configuration;
|
|
23
23
|
const { tableRows } = scope.rows;
|
|
24
|
-
const { data } = scope.listState;
|
|
24
|
+
const { data, readOrder } = scope.listState;
|
|
25
25
|
const { props } = scope;
|
|
26
26
|
const rowIdKey = props.rowIdKey ?? ROW_ID_DEFAULT_KEY;
|
|
27
27
|
|
|
@@ -56,19 +56,21 @@ export function useTableViewRowRealtime<T extends Data>(
|
|
|
56
56
|
data.value = { ...data.value, results: next };
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const findRow = (id: string) =>
|
|
60
|
+
data.value?.results.findIndex((row) => getRowId(row) === id) ?? -1;
|
|
61
61
|
|
|
62
62
|
const patchRowLocal = async (id: string) => {
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const read = rowReadCount;
|
|
63
|
+
if (findRow(id) === -1) return;
|
|
64
|
+
readOrder.rows += 1;
|
|
65
|
+
const read = readOrder.rows;
|
|
66
|
+
const listRead = readOrder.lists;
|
|
68
67
|
try {
|
|
69
68
|
const fresh = await tableRows.getRow(id);
|
|
70
|
-
if (!fresh ||
|
|
71
|
-
|
|
69
|
+
if (!fresh || readOrder.lists !== listRead) return;
|
|
70
|
+
if (read < (readOrder.applied.get(id) ?? 0)) return;
|
|
71
|
+
const idx = findRow(id);
|
|
72
|
+
if (!data.value || idx === -1) return;
|
|
73
|
+
readOrder.applied.set(id, read);
|
|
72
74
|
const next = [...data.value.results];
|
|
73
75
|
next[idx] = fresh;
|
|
74
76
|
data.value = { ...data.value, results: next };
|
|
@@ -24,6 +24,20 @@ export interface TableListDataOptions<T extends Record<string, unknown>> {
|
|
|
24
24
|
heldQuery?: () => Query;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* How the reads of a table list's rows left, shared by every view bound to
|
|
29
|
+
* the list's key: a row answer is dropped when a list read left after its
|
|
30
|
+
* row read, or when a later row read of that row already answered.
|
|
31
|
+
*/
|
|
32
|
+
export interface TableReadOrder {
|
|
33
|
+
/** List reads that left. */
|
|
34
|
+
lists: number;
|
|
35
|
+
/** Row reads that left. */
|
|
36
|
+
rows: number;
|
|
37
|
+
/** The newest row read applied since the last list read left, by row id. */
|
|
38
|
+
applied: Map<string, number>;
|
|
39
|
+
}
|
|
40
|
+
|
|
27
41
|
/** One counter: its id and its list query, as the table view builds it. */
|
|
28
42
|
export interface TableCountRequest {
|
|
29
43
|
id: string;
|
|
@@ -79,16 +93,23 @@ export function useTableListData<T extends Record<string, unknown>>(
|
|
|
79
93
|
isSelfManaged: isSelfManaged.value,
|
|
80
94
|
sourceUrl: rows.sourceUrl.value,
|
|
81
95
|
});
|
|
82
|
-
|
|
96
|
+
const readOrder = useDmsState<TableReadOrder>(`${key}-read-order`, () => ({
|
|
97
|
+
lists: 0,
|
|
98
|
+
rows: 0,
|
|
99
|
+
applied: new Map(),
|
|
100
|
+
})).value;
|
|
101
|
+
const listData = useDmsAsyncData(
|
|
83
102
|
key,
|
|
84
103
|
|
|
85
|
-
({ signal }): Promise<TableViewListResponse<T> | null> =>
|
|
86
|
-
isSelfManaged.value
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
({ signal }): Promise<TableViewListResponse<T> | null> => {
|
|
105
|
+
if (isSelfManaged.value) return Promise.resolve(EMPTY_LIST_RESULT);
|
|
106
|
+
readOrder.lists += 1;
|
|
107
|
+
readOrder.applied.clear();
|
|
108
|
+
return rows.list(
|
|
109
|
+
{ ...query.value, ...archiveQuery.value, ...heldQuery() },
|
|
110
|
+
signal,
|
|
111
|
+
);
|
|
112
|
+
},
|
|
92
113
|
{
|
|
93
114
|
watch: [
|
|
94
115
|
byValue(query),
|
|
@@ -101,6 +122,7 @@ export function useTableListData<T extends Record<string, unknown>>(
|
|
|
101
122
|
refreshOnPageRefresh: false,
|
|
102
123
|
},
|
|
103
124
|
);
|
|
125
|
+
return Object.assign(listData, { readOrder });
|
|
104
126
|
}
|
|
105
127
|
|
|
106
128
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms",
|
|
3
|
-
"version": "0.20.8-next.
|
|
3
|
+
"version": "0.20.8-next.927.g74fccd4",
|
|
4
4
|
"description": "AntelopeJS DMS. Plug in your PostgreSQL, MySQL, MariaDB, MongoDB or RethinkDB database and your coding agent builds a back office and analytics dashboard as typed TypeScript. Real-time updates on the data the DMS manages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"optional": true
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
|
-
"gitHead": "
|
|
199
|
+
"gitHead": "74fccd4534bfdfc6b312ce5d9ca9dfc9e094c53a",
|
|
200
200
|
"scripts": {
|
|
201
201
|
"build": "pnpm --filter @antelopejs/interface-dms --filter @antelopejs/interface-dms-builder build && rimraf dist && tsc && tsc-alias",
|
|
202
202
|
"dev": "ajs project run --inspect -w -p playground",
|