@ai-matrx/design-system 0.17.1 → 0.17.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.
@@ -415,6 +415,7 @@ import {
415
415
  isValidElement,
416
416
  useCallback as useCallback3,
417
417
  useEffect as useEffect9,
418
+ useLayoutEffect,
418
419
  useMemo as useMemo4,
419
420
  useRef as useRef4,
420
421
  useState as useState14
@@ -5450,6 +5451,16 @@ function MatrxDataTableCore({
5450
5451
  ]);
5451
5452
  const scrollRef = useRef4(null);
5452
5453
  const cardsScrollRef = useRef4(null);
5454
+ const previousAppendKeyForScrollReset = useRef4(appendQueryKey);
5455
+ useLayoutEffect(() => {
5456
+ const previous = previousAppendKeyForScrollReset.current;
5457
+ previousAppendKeyForScrollReset.current = appendQueryKey;
5458
+ if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
5459
+ return;
5460
+ }
5461
+ if (scrollRef.current) scrollRef.current.scrollTop = 0;
5462
+ if (cardsScrollRef.current) cardsScrollRef.current.scrollTop = 0;
5463
+ }, [appendQueryKey]);
5453
5464
  const scrollPagination = useScrollPagination({
5454
5465
  containers: [scrollRef, cardsScrollRef],
5455
5466
  queryKey: appendQuery?.pagination.queryKey ?? "",