diff --git a/frontend/src/metadata/hooks/metadata.js b/frontend/src/metadata/hooks/metadata.js index 5cd51e0ab2..b8d0fccb19 100644 --- a/frontend/src/metadata/hooks/metadata.js +++ b/frontend/src/metadata/hooks/metadata.js @@ -103,7 +103,6 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView, view_id: view._id, }; selectMetadataView(node); - setShowFirstView(false); // eslint-disable-next-line react-hooks/exhaustive-deps }, [repoID, selectMetadataView]); @@ -166,6 +165,7 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView, enableMetadata, updateEnableMetadata, showFirstView, + setShowFirstView, navigation, viewsMap: viewsMap.current, selectView, diff --git a/frontend/src/metadata/metadata-view/hooks/metadata.js b/frontend/src/metadata/metadata-view/hooks/metadata.js index dadc6e5e44..08906497ae 100644 --- a/frontend/src/metadata/metadata-view/hooks/metadata.js +++ b/frontend/src/metadata/metadata-view/hooks/metadata.js @@ -5,7 +5,8 @@ import Context from '../context'; import Store from '../store'; import { EVENT_BUS_TYPE, PER_LOAD_NUMBER } from '../constants'; import { Utils } from '../../../utils/utils'; -import { useCollaborators } from '../../hooks'; +import { useCollaborators, useMetadata as usePropsMetadata } from '../../hooks'; +import { gettext } from '../utils'; const MetadataContext = React.createContext(null); @@ -19,6 +20,7 @@ export const MetadataProvider = ({ const [metadata, setMetadata] = useState({ rows: [], columns: [] }); const storeRef = useRef(null); const { collaborators } = useCollaborators(); + const { showFirstView, setShowFirstView } = usePropsMetadata(); const tableChanged = useCallback(() => { setMetadata(storeRef.current.data); @@ -54,7 +56,11 @@ export const MetadataProvider = ({ window.sfMetadataStore = storeRef.current; storeRef.current.initStartIndex(); storeRef.current.load(PER_LOAD_NUMBER).then(() => { + if (showFirstView && storeRef.current.data.rows.length === 0) { + toaster.success(gettext('The files\' metadata is being created. This may take a minute or so. Please refresh the page later.')); + } setMetadata(storeRef.current.data); + setShowFirstView(false); setLoading(false); }).catch(error => { const errorMsg = Utils.getErrorMsg(error);