Skip to content

Commit

Permalink
fix(current_event): fix autoscroll to selected event (#440)
Browse files Browse the repository at this point in the history
fix event list auto-scroll when the event opens by link
  • Loading branch information
dqunbp authored Feb 10, 2023
1 parent ad3f52b commit 85c4fe2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/features/events_list/components/FullState/FullState.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Virtuoso } from 'react-virtuoso';
import { useAtom } from '@reatom/react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
import { LoadingSpinner } from '~components/LoadingSpinner/LoadingSpinner';
import { ErrorMessage } from '~components/ErrorMessage/ErrorMessage';
import { i18n } from '~core/localization';
Expand Down Expand Up @@ -37,7 +37,7 @@ export function FullState({
});

// Virtual event list rendering effect
useEffect(() => {
useLayoutEffect(() => {
const ref = virtuoso.current;
if (ref && currentEventId && eventsList?.length) {
const currentEventIndex = eventsList.findIndex(
Expand Down

0 comments on commit 85c4fe2

Please sign in to comment.