From 4bdeb609e2c95e8989cefbefe99435939b1adcc6 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 15 Mar 2021 18:49:43 -0700 Subject: [PATCH] flow: various flow fixes --- app/components/Layout.js | 2 -- app/components/Sidebar/components/CollectionLink.js | 4 ++-- app/models/Collection.js | 4 ++-- app/stores/CollectionsStore.js | 5 ++++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/components/Layout.js b/app/components/Layout.js index 46b343f7d7..c43912bd4c 100644 --- a/app/components/Layout.js +++ b/app/components/Layout.js @@ -93,8 +93,6 @@ class Layout extends React.Component { @keydown("n") goToNewDocument() { - if (this.props.ui.editMode) return; - const { activeCollectionId } = this.props.ui; if (!activeCollectionId) return; diff --git a/app/components/Sidebar/components/CollectionLink.js b/app/components/Sidebar/components/CollectionLink.js index 57068301ea..d0ccc5ee7c 100644 --- a/app/components/Sidebar/components/CollectionLink.js +++ b/app/components/Sidebar/components/CollectionLink.js @@ -23,9 +23,9 @@ type Props = {| canUpdate: boolean, activeDocument: ?Document, prefetchDocument: (id: string) => Promise, - belowCollection: Collection | undefined, + belowCollection: Collection | void, isAnyCollectionDragging: boolean, - setIsAnyCollectionDragging: () => void, + setIsAnyCollectionDragging: (dragging: boolean) => void, |}; function CollectionLink({ diff --git a/app/models/Collection.js b/app/models/Collection.js index 7beb2e7362..254333d767 100644 --- a/app/models/Collection.js +++ b/app/models/Collection.js @@ -19,8 +19,8 @@ export default class Collection extends BaseModel { sharing: boolean; index: string; documents: NavigationNode[]; - createdAt: ?string; - updatedAt: ?string; + createdAt: string; + updatedAt: string; deletedAt: ?string; sort: { field: string, direction: "asc" | "desc" }; url: string; diff --git a/app/stores/CollectionsStore.js b/app/stores/CollectionsStore.js index d479a472bb..f24d8e0a7a 100644 --- a/app/stores/CollectionsStore.js +++ b/app/stores/CollectionsStore.js @@ -111,7 +111,10 @@ export default class CollectionsStore extends BaseStore { }); invariant(res && res.success, "Collection could not be moved"); const collection = this.get(collectionId); - collection.updateIndex(index); + + if (collection) { + collection.updateIndex(index); + } }; async update(params: Object): Promise {