mirror of
https://github.com/strapi/strapi.git
synced 2025-08-08 00:37:38 +00:00
apply PR review
Signed-off-by: Ky <virginie.ky@gmail.com>
This commit is contained in:
parent
c02abe90fc
commit
def471ef5f
@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { PageFooter, useQuery } from 'strapi-helper-plugin';
|
||||
import { generatePageFromStart, generateStartFromPage } from '../../utils';
|
||||
import { generatePageFromStart, generateStartFromPage } from '../../../utils';
|
||||
|
||||
import List from '../List';
|
||||
import ListEmpty from '../ListEmpty';
|
||||
import Padded from '../Padded';
|
||||
import List from '../../../components/List';
|
||||
import ListEmpty from '../../../components/ListEmpty';
|
||||
import Padded from '../../../components/Padded';
|
||||
|
||||
const HomePageList = ({
|
||||
areResultsEmptyWithSettings,
|
@ -2,13 +2,13 @@ import React, { useEffect, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useDebounce } from '@buffetjs/hooks';
|
||||
import { HeaderSearch, useGlobalContext, useQuery } from 'strapi-helper-plugin';
|
||||
import { getTrad, getFileModelTimestamps } from '../../utils';
|
||||
import { getTrad, getFileModelTimestamps } from '../../../utils';
|
||||
|
||||
import ControlsWrapper from '../ControlsWrapper';
|
||||
import Filters from '../Filters';
|
||||
import Padded from '../Padded';
|
||||
import SelectAll from '../SelectAll';
|
||||
import SortPicker from '../SortPicker';
|
||||
import ControlsWrapper from '../../../components/ControlsWrapper';
|
||||
import Filters from '../../../components/Filters';
|
||||
import Padded from '../../../components/Padded';
|
||||
import SelectAll from '../../../components/SelectAll';
|
||||
import SortPicker from '../../../components/SortPicker';
|
||||
|
||||
const HomePageSettings = ({
|
||||
areAllCheckboxesSelected,
|
@ -4,8 +4,8 @@ import { isEmpty } from 'lodash';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { generateFiltersFromSearch, useQuery } from 'strapi-helper-plugin';
|
||||
|
||||
import HomePageSettings from '../HomePageSettings';
|
||||
import HomePageList from '../HomePageList';
|
||||
import HomePageSettings from './HomePageSettings';
|
||||
import HomePageList from './HomePageList';
|
||||
|
||||
const HomePageContent = ({
|
||||
data,
|
@ -1,7 +1,6 @@
|
||||
import React, { useReducer, useState, useEffect } from 'react';
|
||||
import React, { useReducer, useRef, useState, useEffect } from 'react';
|
||||
import { includes, toString, isEqual, intersectionWith } from 'lodash';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import { useIsMounted } from '@buffetjs/hooks';
|
||||
import { Header } from '@buffetjs/custom';
|
||||
import {
|
||||
PopUpWarning,
|
||||
@ -14,7 +13,7 @@ import {
|
||||
} from 'strapi-helper-plugin';
|
||||
import { formatFileForEditing, getRequestUrl, getTrad, getFileModelTimestamps } from '../../utils';
|
||||
import Container from '../../components/Container';
|
||||
import HomePageContent from '../../components/HomePageContent';
|
||||
import HomePageContent from './HomePageContent';
|
||||
import Padded from '../../components/Padded';
|
||||
import ModalStepper from '../ModalStepper';
|
||||
import { generateStringFromParams, getHeaderLabel } from './utils';
|
||||
@ -33,11 +32,15 @@ const HomePage = () => {
|
||||
const [modalInitialStep, setModalInitialStep] = useState('browse');
|
||||
const { push } = useHistory();
|
||||
const { search } = useLocation();
|
||||
const isMounted = useIsMounted();
|
||||
const isMounted = useRef(true);
|
||||
const { data, dataCount, dataToDelete, isLoading } = reducerState.toJS();
|
||||
const pluginName = formatMessage({ id: getTrad('plugin.name') });
|
||||
const paramsKeys = ['_limit', '_start', '_q', '_sort'];
|
||||
|
||||
useEffect(() => {
|
||||
return () => (isMounted.current = false);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchListData();
|
||||
|
||||
@ -52,7 +55,7 @@ const HomePage = () => {
|
||||
method: 'DELETE',
|
||||
});
|
||||
} catch (err) {
|
||||
if (isMounted) {
|
||||
if (isMounted.current) {
|
||||
strapi.notification.error('notification.error');
|
||||
}
|
||||
}
|
||||
@ -73,7 +76,7 @@ const HomePage = () => {
|
||||
|
||||
return Promise.resolve(data);
|
||||
} catch (err) {
|
||||
if (isMounted) {
|
||||
if (isMounted.current) {
|
||||
dispatch({ type: 'GET_DATA_ERROR' });
|
||||
strapi.notification.error('notification.error');
|
||||
}
|
||||
@ -93,7 +96,7 @@ const HomePage = () => {
|
||||
|
||||
return Promise.resolve(count);
|
||||
} catch (err) {
|
||||
if (isMounted) {
|
||||
if (isMounted.current) {
|
||||
dispatch({ type: 'GET_DATA_ERROR' });
|
||||
strapi.notification.error('notification.error');
|
||||
}
|
||||
@ -107,7 +110,7 @@ const HomePage = () => {
|
||||
|
||||
const [data, count] = await Promise.all([fetchData(), fetchDataCount()]);
|
||||
|
||||
if (isMounted) {
|
||||
if (isMounted.current) {
|
||||
dispatch({
|
||||
type: 'GET_DATA_SUCCEEDED',
|
||||
data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user