⚡️⚡️⚡️ 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
Commit
stuzer05007de56cd329
diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsxindex f9ae0472..628f3ff1 100644--- a/components/CollectionListing.tsx+++ b/components/CollectionListing.tsx@@ -112,7 +112,12 @@ const CollectionListing = () => {);};- function reorderTreeItems(tree, movedCollectionId, source, destination) {+ function reorderTreeItems(+ tree: TreeData,+ movedCollectionId: ItemId,+ source: TreeSourcePosition,+ destination: TreeDestinationPosition+ ) {// Same parent reorderingif (source.parentId === destination.parentId) {const parent = tree.items[source.parentId];@@ -121,7 +126,9 @@ const CollectionListing = () => {// Remove from source indexchildren.splice(source.index, 1);// Insert at destination index- children.splice(destination.index, 0, movedCollectionId);+ if (destination.index) {+ children.splice(destination.index, 0, movedCollectionId);+ }parent.children = children;return tree;@@ -132,7 +139,9 @@ const CollectionListing = () => {const destinationParent = tree.items[destination.parentId];// Remove from source parent- sourceParent.children = sourceParent.children.filter(id => id !== movedCollectionId);+ sourceParent.children = sourceParent.children.filter(+ (id) => id !== movedCollectionId+ );// Initialize children array if it doesn't existif (!destinationParent.children) {@@ -140,9 +149,10 @@ const CollectionListing = () => {}// If destination index is not specified, add to the end- const destinationIndex = destination.index !== undefined ?- destination.index :- destinationParent.children.length;+ const destinationIndex =+ destination.index !== undefined+ ? destination.index+ : destinationParent.children.length;// Add to destination parentdestinationParent.children.splice(destinationIndex, 0, movedCollectionId);@@ -157,7 +167,7 @@ const CollectionListing = () => {return tree;}- function flattenTreeIds(tree, nodeId = 'root', result = []) {+ function flattenTreeIds(tree: TreeData, nodeId: ItemId = 'root', result: Array<ItemId> = []) {const node = tree.items[nodeId];if (nodeId !== 'root') {