1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 19:29:56 +00:00

remove-cache

This commit is contained in:
yinjianfei
2024-01-20 18:17:17 +08:00
parent 275724ca47
commit 28ee6d411b

View File

@@ -20,7 +20,6 @@ export default class SdocEditor extends React.Component {
componentDidMount() {
this.onSetFavicon();
this.getDirentList();
this.cacheHistoryfiles();
}
toggleStar = (isStarred) => {
@@ -44,25 +43,6 @@ export default class SdocEditor extends React.Component {
this.onSetFavicon('_notification');
};
cacheHistoryfiles = () => {
const { docName, docUuid } = window.seafile;
const rencentFiles = localStorage.getItem('sdoc-recent-files') ? JSON.parse(localStorage.getItem('sdoc-recent-files')) : [];
let arr = [];
const newFile = { doc_uuid: docUuid, name: docName };
if (rencentFiles.length > 0) {
const isExist = rencentFiles.find((item) => item.doc_uuid === docUuid);
if (isExist) return;
if (!isExist) {
let newRencentFiles = rencentFiles.slice(0);
if (rencentFiles.length === 10) {newRencentFiles.shift();}
arr = [newFile, ...newRencentFiles];
}
} else {
arr.push(newFile);
}
localStorage.setItem('sdoc-recent-files', JSON.stringify(arr));
};
getDirPath = () => {
const { docPath } = window.seafile;
const index = docPath.lastIndexOf('/');