diff --git a/client/src/components/eula/eula.component.jsx b/client/src/components/eula/eula.component.jsx index b73f39052..c1130c783 100644 --- a/client/src/components/eula/eula.component.jsx +++ b/client/src/components/eula/eula.component.jsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect, useRef, useState } from "react"; -import {Button, Card, Checkbox, Col, Form, Input, Modal, notification, Row, Space} from "antd"; +import {Button, Card, Checkbox, Col, Form, Input, Modal, notification, Row} from "antd"; import Markdown from "react-markdown"; import { createStructuredSelector } from "reselect"; import { selectCurrentEula, selectCurrentUser } from "../../redux/user/user.selectors"; @@ -22,18 +22,18 @@ const Eula = ({ currentEula, currentUser, acceptEula }) => { const { t } = useTranslation(); const [api, contextHolder] = notification.useNotification(); - const handleScroll = (e) => { + const handleScroll = useCallback((e) => { const bottom = e.target.scrollHeight - 100 <= e.target.scrollTop + e.target.clientHeight; if (bottom && !hasEverScrolledToBottom) { setHasEverScrolledToBottom(true); } else if (e.target.scrollHeight <= e.target.clientHeight && !hasEverScrolledToBottom) { setHasEverScrolledToBottom(true); } - }; + }, [hasEverScrolledToBottom, setHasEverScrolledToBottom]); useEffect(() => { handleScroll({ target: markdownCardRef.current }); - }, []); + }, [handleScroll]); const handleChange = useCallback(() => { form.validateFields({ validateOnly: true })