mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Reset Carousel position on data refresh (#303)
* Reset Carousel position on data refresh * add refresh for all carousels
This commit is contained in:
parent
03e582f301
commit
fe298d3232
2 changed files with 54 additions and 28 deletions
|
|
@ -1,4 +1,13 @@
|
|||
import { isValidElement, memo, ReactNode, useCallback, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
isValidElement,
|
||||
memo,
|
||||
ReactNode,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { Group, Stack } from '@mantine/core';
|
||||
import throttle from 'lodash/throttle';
|
||||
import { RiArrowLeftSLine, RiArrowRightSLine } from 'react-icons/ri';
|
||||
|
|
@ -109,6 +118,10 @@ export const SwiperGridCarousel = ({
|
|||
const playButtonBehavior = usePlayButtonBehavior();
|
||||
const handlePlayQueueAdd = usePlayQueueAdd();
|
||||
|
||||
useEffect(() => {
|
||||
swiperRef.current?.slideTo(0, 0);
|
||||
}, [data]);
|
||||
|
||||
const [pagination, setPagination] = useState({
|
||||
hasNextPage: (data?.length || 0) > Math.round(3),
|
||||
hasPreviousPage: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue