From d9c50d2568355f1c91e0d2dd127027bf5d9c4052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=9B=BD=E7=92=87?= Date: Wed, 8 Jan 2025 16:12:22 +0800 Subject: [PATCH] fix: search repo change --- frontend/src/metadata/hooks/metadata.js | 3 ++- frontend/src/pages/lib-content-view/lib-content-view.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/metadata/hooks/metadata.js b/frontend/src/metadata/hooks/metadata.js index 8c8131556e..8bf2bd22f3 100644 --- a/frontend/src/metadata/hooks/metadata.js +++ b/frontend/src/metadata/hooks/metadata.js @@ -88,7 +88,8 @@ export const MetadataProvider = ({ repoID, currentPath, repoInfo, selectMetadata const errorMsg = Utils.getErrorMsg(error); toaster.danger(errorMsg); }); - }, [repoID, enableMetadata]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [enableMetadata]); const getFirstView = useCallback(() => { const firstViewNav = navigation.find(item => item.type === VIEWS_TYPE_VIEW); diff --git a/frontend/src/pages/lib-content-view/lib-content-view.js b/frontend/src/pages/lib-content-view/lib-content-view.js index ba90c75833..cd20952d46 100644 --- a/frontend/src/pages/lib-content-view/lib-content-view.js +++ b/frontend/src/pages/lib-content-view/lib-content-view.js @@ -160,7 +160,9 @@ class LibContentView extends React.Component { UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.repoID !== this.props.repoID) { - this.calculatePara(nextProps); + this.setState({ path: '/', viewId: '', tagID: '', currentMode: cookie.load('seafile_view_mode') || LIST_MODE }, () => { + this.calculatePara(nextProps); + }); } }