mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
scroll into view
This commit is contained in:
parent
4895a533cc
commit
0eefea6d0b
@ -15,20 +15,17 @@ export default function Event({ eventId, close, scrollRef }) {
|
||||
const apiHost = useApiHost();
|
||||
const { data, status } = useEvent(eventId);
|
||||
const [showDialog, setShowDialog] = useState(false);
|
||||
const [shouldScroll, setShouldScroll] = useState(true);
|
||||
const [deleteStatus, setDeleteStatus] = useState(FetchStatus.NONE);
|
||||
const setDeleteEvent = useDelete();
|
||||
|
||||
useEffect(() => {
|
||||
// Call Events.js scroll when this event has been mounted.
|
||||
// scrollIntoView(eventId);
|
||||
scrollToElement();
|
||||
}, [data]);
|
||||
|
||||
const scrollToElement = useCallback(() => {
|
||||
if (scrollRef && scrollRef[eventId]) {
|
||||
// Scroll event into view when component has been mounted.
|
||||
if (shouldScroll && scrollRef && scrollRef[eventId]) {
|
||||
scrollRef[eventId].scrollIntoView();
|
||||
setShouldScroll(false);
|
||||
}
|
||||
}, [scrollRef]);
|
||||
}, [data, scrollRef, eventId, shouldScroll]);
|
||||
|
||||
const handleClickDelete = () => {
|
||||
setShowDialog(true);
|
||||
|
||||
@ -80,7 +80,6 @@ export default function Events({ path: pathname, limit = API_LIMIT } = {}) {
|
||||
}
|
||||
|
||||
if (data && Array.isArray(data) && data.length + deleted < limit) {
|
||||
console.log('reached end');
|
||||
dispatch({ type: 'REACHED_END', meta: { searchString } });
|
||||
}
|
||||
}, [data, limit, searchString, searchStrings, deleted]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user