fix: flash of 'Deleted Collection' when loading app on doc page

This commit is contained in:
Tom Moor
2021-02-02 22:03:02 -08:00
parent 6d88c02869
commit 37fa13d841
2 changed files with 15 additions and 16 deletions

View File

@@ -20,10 +20,11 @@ import useStores from "hooks/useStores";
import BreadcrumbMenu from "menus/BreadcrumbMenu";
import { collectionUrl } from "utils/routeHelpers";
type Props = {
type Props = {|
document: Document,
children?: React.Node,
onlyText: boolean,
};
|};
function Icon({ document }) {
const { t } = useTranslation();
@@ -79,10 +80,14 @@ function Icon({ document }) {
return null;
}
const Breadcrumb = ({ document, onlyText }: Props) => {
const Breadcrumb = ({ document, children, onlyText }: Props) => {
const { collections } = useStores();
const { t } = useTranslation();
if (!collections.isLoaded) {
return <Wrapper />;
}
let collection = collections.get(document.collectionId);
if (!collection) {
collection = {
@@ -140,6 +145,7 @@ const Breadcrumb = ({ document, onlyText }: Props) => {
</Crumb>
</>
)}
{children}
</Wrapper>
);
};