Files
outline/app/components/Sidebar/Shared.tsx
Tom Moor 4468d29740 perf: Navigation of shared trees feels slow (#3171)
* perf: Navigation of shared trees feels slow

* remove redundant call to setActiveDocument

Co-authored-by: Nan Yu <thenanyu@gmail.com>
2022-03-01 21:51:51 -08:00

42 lines
1.0 KiB
TypeScript

import { observer } from "mobx-react";
import * as React from "react";
import styled from "styled-components";
import Scrollable from "~/components/Scrollable";
import useStores from "~/hooks/useStores";
import { NavigationNode } from "~/types";
import Sidebar from "./Sidebar";
import Section from "./components/Section";
import DocumentLink from "./components/SharedDocumentLink";
type Props = {
rootNode: NavigationNode;
shareId: string;
};
function SharedSidebar({ rootNode, shareId }: Props) {
const { ui, documents } = useStores();
return (
<Sidebar>
<ScrollContainer flex>
<Section>
<DocumentLink
index={0}
shareId={shareId}
depth={1}
node={rootNode}
activeDocumentId={ui.activeDocumentId}
activeDocument={documents.active}
/>
</Section>
</ScrollContainer>
</Sidebar>
);
}
const ScrollContainer = styled(Scrollable)`
padding-bottom: 16px;
`;
export default observer(SharedSidebar);