Merge pull request #1288 from ONLYOFFICE/bugfix/fixed-loader-blinking

Web: Client: added a small delay to the loader so that there is no fl…
This commit is contained in:
Alexey Safronov 2023-03-06 23:04:27 +04:00 committed by GitHub
commit 32b4bc6afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,10 +50,17 @@ const ArticleBodyContent = (props) => {
const [disableBadgeClick, setDisableBadgeClick] = React.useState(false);
let loadTimeout = null;
const campaigns = (localStorage.getItem("campaigns") || "")
.split(",")
.filter((campaign) => campaign.length > 0);
const cleanTimer = () => {
loadTimeout && clearTimeout(loadTimeout);
loadTimeout = null;
};
const onClick = React.useCallback(
(folderId) => {
const {
@ -72,7 +79,9 @@ const ArticleBodyContent = (props) => {
const filesSection = window.location.pathname.indexOf("/filter") > 0;
if (filesSection) {
setIsLoading(true);
loadTimeout = setTimeout(() => {
setIsLoading(true);
}, 200);
} else {
showLoader();
}
@ -88,6 +97,7 @@ const ArticleBodyContent = (props) => {
fetchRooms(folderId, filter).finally(() => {
if (filesSection) {
cleanTimer();
setIsLoading(false);
} else {
hideLoader();