fix: has local backup icon appearing when local backups are disabled (#876)
This commit is contained in:
parent
48b472163f
commit
8d79994954
@ -101,6 +101,10 @@ const EntryCard: FC<TranslatedProps<EntryCardProps>> = ({
|
|||||||
|
|
||||||
const [hasLocalBackup, setHasLocalBackup] = useState(false);
|
const [hasLocalBackup, setHasLocalBackup] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (config?.disable_local_backup) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let alive = true;
|
let alive = true;
|
||||||
|
|
||||||
const checkLocalBackup = async () => {
|
const checkLocalBackup = async () => {
|
||||||
@ -122,7 +126,7 @@ const EntryCard: FC<TranslatedProps<EntryCardProps>> = ({
|
|||||||
return () => {
|
return () => {
|
||||||
alive = false;
|
alive = false;
|
||||||
};
|
};
|
||||||
}, [collection.name, entry.slug]);
|
}, [collection.name, config?.disable_local_backup, entry.slug]);
|
||||||
|
|
||||||
if (PreviewCardComponent) {
|
if (PreviewCardComponent) {
|
||||||
return (
|
return (
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
} from '@staticcms/core/lib/util/collection.util';
|
} from '@staticcms/core/lib/util/collection.util';
|
||||||
import localForage from '@staticcms/core/lib/util/localForage';
|
import localForage from '@staticcms/core/lib/util/localForage';
|
||||||
import { isNullish } from '@staticcms/core/lib/util/null.util';
|
import { isNullish } from '@staticcms/core/lib/util/null.util';
|
||||||
|
import { selectConfig } from '@staticcms/core/reducers/selectors/config';
|
||||||
import { selectTheme } from '@staticcms/core/reducers/selectors/globalUI';
|
import { selectTheme } from '@staticcms/core/reducers/selectors/globalUI';
|
||||||
import { useAppSelector } from '@staticcms/core/store/hooks';
|
import { useAppSelector } from '@staticcms/core/store/hooks';
|
||||||
import TableCell from '../../common/table/TableCell';
|
import TableCell from '../../common/table/TableCell';
|
||||||
@ -43,6 +44,8 @@ const EntryRow: FC<TranslatedProps<EntryRowProps>> = ({
|
|||||||
|
|
||||||
const fields = selectFields(collection, entry.slug);
|
const fields = selectFields(collection, entry.slug);
|
||||||
|
|
||||||
|
const config = useAppSelector(selectConfig);
|
||||||
|
|
||||||
const templateName = useMemo(
|
const templateName = useMemo(
|
||||||
() => selectTemplateName(collection, entry.slug),
|
() => selectTemplateName(collection, entry.slug),
|
||||||
[collection, entry.slug],
|
[collection, entry.slug],
|
||||||
@ -52,6 +55,10 @@ const EntryRow: FC<TranslatedProps<EntryRowProps>> = ({
|
|||||||
|
|
||||||
const [hasLocalBackup, setHasLocalBackup] = useState(false);
|
const [hasLocalBackup, setHasLocalBackup] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (config?.disable_local_backup) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let alive = true;
|
let alive = true;
|
||||||
|
|
||||||
const checkLocalBackup = async () => {
|
const checkLocalBackup = async () => {
|
||||||
@ -73,7 +80,7 @@ const EntryRow: FC<TranslatedProps<EntryRowProps>> = ({
|
|||||||
return () => {
|
return () => {
|
||||||
alive = false;
|
alive = false;
|
||||||
};
|
};
|
||||||
}, [collection.name, entry.slug]);
|
}, [collection.name, config?.disable_local_backup, entry.slug]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow className={entriesClasses['entry-listing-table-row']} to={path}>
|
<TableRow className={entriesClasses['entry-listing-table-row']} to={path}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user