[RecentlyViewed]
- delete,cancel 버튼 클릭시 api 호출하는 문제 수정
This commit is contained in:
@@ -1,29 +1,39 @@
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import {
|
||||
useDispatch,
|
||||
useSelector,
|
||||
} from 'react-redux';
|
||||
|
||||
import Spotlight from "@enact/spotlight";
|
||||
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
||||
import Spotlight from '@enact/spotlight';
|
||||
import SpotlightContainerDecorator
|
||||
from '@enact/spotlight/SpotlightContainerDecorator';
|
||||
|
||||
import {
|
||||
changeAppStatus,
|
||||
changeLocalSettings,
|
||||
} from "../../../../actions/commonActions";
|
||||
} from '../../../../actions/commonActions';
|
||||
import {
|
||||
clearRecentlyViewedInfo,
|
||||
getMyRecentlyViewedInfo,
|
||||
} from "../../../../actions/myPageActions";
|
||||
import { popPanel } from "../../../../actions/panelActions";
|
||||
import TBody from "../../../../components/TBody/TBody";
|
||||
import TButton, { TYPES } from "../../../../components/TButton/TButton";
|
||||
import TCheckBox from "../../../../components/TCheckBox/TCheckBox";
|
||||
import THeader from "../../../../components/THeader/THeader";
|
||||
import TVerticalPagenator from "../../../../components/TVerticalPagenator/TVerticalPagenator";
|
||||
import useLogService from "../../../../hooks/useLogService";
|
||||
import { $L } from "../../../../utils/helperMethods";
|
||||
import { SpotlightIds } from "../../../../utils/SpotlightIds";
|
||||
import css from "../RecentlyViewed/RecentlyViewed.module.less";
|
||||
import RecentlyViewedContents from "./RecentlyViewedContents";
|
||||
} from '../../../../actions/myPageActions';
|
||||
import { popPanel } from '../../../../actions/panelActions';
|
||||
import TBody from '../../../../components/TBody/TBody';
|
||||
import TButton, { TYPES } from '../../../../components/TButton/TButton';
|
||||
import TCheckBox from '../../../../components/TCheckBox/TCheckBox';
|
||||
import THeader from '../../../../components/THeader/THeader';
|
||||
import TVerticalPagenator
|
||||
from '../../../../components/TVerticalPagenator/TVerticalPagenator';
|
||||
import useLogService from '../../../../hooks/useLogService';
|
||||
import { $L } from '../../../../utils/helperMethods';
|
||||
import { SpotlightIds } from '../../../../utils/SpotlightIds';
|
||||
import css from '../RecentlyViewed/RecentlyViewed.module.less';
|
||||
import RecentlyViewedContents from './RecentlyViewedContents';
|
||||
|
||||
const HeaderButtonContainer = SpotlightContainerDecorator(
|
||||
{ enterTo: "last-focused" },
|
||||
@@ -69,14 +79,12 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) {
|
||||
);
|
||||
}
|
||||
if (recentlyDatas) {
|
||||
timerRef.current = setTimeout(()=>{
|
||||
const node = document.querySelector(`[id="${SpotlightIds.TBODY}"]` );
|
||||
if(node){
|
||||
timerRef.current = setTimeout(() => {
|
||||
const node = document.querySelector(`[id="${SpotlightIds.TBODY}"]`);
|
||||
if (node) {
|
||||
Spotlight.focus(node);
|
||||
}
|
||||
},
|
||||
0
|
||||
);
|
||||
}, 0);
|
||||
}
|
||||
}, [recentlyDatas]);
|
||||
|
||||
@@ -105,22 +113,18 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) {
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
setSelectedItems(initialSelectedItems);
|
||||
}, [recentlyDatas]);
|
||||
}, [activeDelete]);
|
||||
|
||||
useEffect(() => {
|
||||
groupByDate();
|
||||
}, [dispatch, activeDelete]);
|
||||
}, [dispatch]);
|
||||
|
||||
const handlePreviousButtonClick = useCallback(() => {
|
||||
dispatch(popPanel());
|
||||
}, [dispatch]);
|
||||
|
||||
const handleDeleteBtnClick = useCallback(() => {
|
||||
dispatch(
|
||||
changeAppStatus({ showLoadingPanel: { show: true, type: "wait" } })
|
||||
);
|
||||
if (activeDelete) {
|
||||
let recentItems = [...localRecentItems];
|
||||
|
||||
@@ -166,6 +170,7 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) {
|
||||
cnt: `${Object.keys(selectedItems).length - recentItems.length}`,
|
||||
});
|
||||
}
|
||||
groupByDate();
|
||||
}
|
||||
|
||||
setActiveDelete((prev) => !prev);
|
||||
|
||||
Reference in New Issue
Block a user