⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
minor fix
daniel31x1351cf8172ffe1
diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsxindex a428a107..716c1503 100644--- a/components/CollectionListing.tsx+++ b/components/CollectionListing.tsx@@ -1,4 +1,4 @@-import React, { useEffect, useState } from "react";+import React, { useEffect, useMemo, useState } from "react";import Tree, {mutateTree,moveItemOnTree,@@ -20,33 +20,35 @@ interface ExtendedTreeItem extends TreeItem {}const CollectionListing = () => {- const [tree, setTree] = useState<TreeData>();-const { collections } = useCollectionStore();const router = useRouter();const currentPath = router.asPath;+ const initialTree = useMemo(() => {+ if (collections.length > 0) {+ return buildTreeFromCollections(collections, router);+ }+ return undefined;+ }, [collections, router]);++ const [tree, setTree] = useState(initialTree);+useEffect(() => {- const initialTree = buildTreeFromCollections(collections, router);- collections[0] && setTree(initialTree);- }, [collections]);+ setTree(initialTree);+ }, [initialTree]);const onExpand = (itemId: ItemId) => {- if (tree) {- setTree((currentTree) =>- mutateTree(currentTree!, itemId, { isExpanded: true })- );- }+ setTree((currentTree) =>+ mutateTree(currentTree!, itemId, { isExpanded: true })+ );};const onCollapse = (itemId: ItemId) => {- if (tree) {- setTree((currentTree) =>- mutateTree(currentTree as TreeData, itemId, { isExpanded: false })- );- }+ setTree((currentTree) =>+ mutateTree(currentTree as TreeData, itemId, { isExpanded: false })+ );};const onDragEnd = (diff --git a/components/Sidebar.tsx b/components/Sidebar.tsxindex d77dbacb..b5fd88ae 100644--- a/components/Sidebar.tsx+++ b/components/Sidebar.tsx@@ -98,7 +98,7 @@ export default function Sidebar({ className }: { className?: string }) {leaveTo="transform opacity-0 -translate-y-3"><Disclosure.Panel>- <CollectionListing links={true} />+ <CollectionListing /></Disclosure.Panel></Transition></Disclosure>diff --git a/types/nav.ts b/types/nav.tsdeleted file mode 100644index 5fa87044..00000000--- a/types/nav.ts+++ /dev/null@@ -1 +0,0 @@-declare module "@atlaskit/navigation";