@izumisy-tailor/tailor-data-viewer 0.2.16 → 0.2.17
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
CHANGED
|
@@ -54,10 +54,7 @@ type ResolveVariables<TQuery> =
|
|
|
54
54
|
* const [result] = useQuery({ ...collection.toQueryArgs() });
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
|
-
export function useCollection<
|
|
58
|
-
const TTable extends TableMetadata,
|
|
59
|
-
TQuery,
|
|
60
|
-
>(
|
|
57
|
+
export function useCollection<const TTable extends TableMetadata, TQuery>(
|
|
61
58
|
options: UseCollectionOptions<
|
|
62
59
|
TableFieldName<TTable>,
|
|
63
60
|
TableMetadataFilter<TTable>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import type {
|
|
3
3
|
Column,
|
|
4
4
|
DataTableCellProps,
|
|
@@ -54,7 +54,7 @@ export function useDataTable<TRow extends Record<string, unknown>>(
|
|
|
54
54
|
const rows = optimisticRows ?? sourceRows;
|
|
55
55
|
|
|
56
56
|
// Reset optimistic state when source data changes
|
|
57
|
-
|
|
57
|
+
useEffect(() => {
|
|
58
58
|
setOptimisticRows(null);
|
|
59
59
|
}, [sourceRows]);
|
|
60
60
|
|
|
@@ -70,11 +70,11 @@ export function useDataTable<TRow extends Record<string, unknown>>(
|
|
|
70
70
|
}, [data]);
|
|
71
71
|
|
|
72
72
|
// Sync pageInfo to collection so hasPrevPage/hasNextPage are up-to-date
|
|
73
|
-
|
|
73
|
+
useEffect(() => {
|
|
74
74
|
if (data?.pageInfo) {
|
|
75
75
|
collection?.setPageInfo(data.pageInfo);
|
|
76
76
|
}
|
|
77
|
-
}, [data?.pageInfo, collection]);
|
|
77
|
+
}, [data?.pageInfo, collection?.setPageInfo]);
|
|
78
78
|
|
|
79
79
|
// ---------------------------------------------------------------------------
|
|
80
80
|
// Column visibility management
|