mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-01 23:38:37 +00:00
feat: optimzie code
This commit is contained in:
parent
42daa80f2e
commit
2a6fd1610f
@ -7,7 +7,7 @@ import { MetadataAIOperationsProvider } from './metadata-ai-operation';
|
|||||||
// This hook provides content related to seahub interaction, such as whether to enable extended attributes
|
// This hook provides content related to seahub interaction, such as whether to enable extended attributes
|
||||||
const MetadataStatusContext = React.createContext(null);
|
const MetadataStatusContext = React.createContext(null);
|
||||||
|
|
||||||
export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, callback, children }) => {
|
export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, statusCallback, children }) => {
|
||||||
const enableMetadataManagement = useMemo(() => {
|
const enableMetadataManagement = useMemo(() => {
|
||||||
if (repoInfo?.encrypted) return false;
|
if (repoInfo?.encrypted) return false;
|
||||||
return window.app.pageOptions.enableMetadataManagement;
|
return window.app.pageOptions.enableMetadataManagement;
|
||||||
@ -77,7 +77,7 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, cal
|
|||||||
}, [repoID, enableMetadataManagement]);
|
}, [repoID, enableMetadataManagement]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
callback && callback({ enableMetadata, enableTags });
|
statusCallback && statusCallback({ enableMetadata, enableTags });
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [enableMetadata, enableTags]);
|
}, [enableMetadata, enableTags]);
|
||||||
|
|
||||||
|
@ -2328,7 +2328,7 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
const detailDirent = currentDirent || currentNode?.object || null;
|
const detailDirent = currentDirent || currentNode?.object || null;
|
||||||
return (
|
return (
|
||||||
<MetadataStatusProvider repoID={repoID} repoInfo={currentRepoInfo} hideMetadataView={this.hideMetadataView} callback={this.metadataStatusCallback} >
|
<MetadataStatusProvider repoID={repoID} repoInfo={currentRepoInfo} hideMetadataView={this.hideMetadataView} statusCallback={this.metadataStatusCallback} >
|
||||||
<TagsProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectTagsView={this.onTreeNodeClick} >
|
<TagsProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectTagsView={this.onTreeNodeClick} >
|
||||||
<MetadataProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectMetadataView={this.onTreeNodeClick} >
|
<MetadataProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectMetadataView={this.onTreeNodeClick} >
|
||||||
<CollaboratorsProvider repoID={repoID}>
|
<CollaboratorsProvider repoID={repoID}>
|
||||||
|
Loading…
Reference in New Issue
Block a user