about summary refs log tree commit diff
path: root/src/state/models/ui/saved-feeds.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-11-02 12:09:57 -0700
committerGitHub <noreply@github.com>2023-11-02 12:09:57 -0700
commit0f4bfcb05d4d902209126cca216eac31d49c8f80 (patch)
tree51de199207ed0d029f76aaf1125058bda1fc40d7 /src/state/models/ui/saved-feeds.ts
parent0e8723c3bb9566542f009994484b30c3da72ede7 (diff)
downloadvoidsky-0f4bfcb05d4d902209126cca216eac31d49c8f80.tar.zst
Replace draglist due to upstream errors (#1795)
* Replace draggable flatlist with simple sort buttons

* Remove react-native-draggable-flatlist dep

* Fix hitslops

* Update lockfile

* Remove bad flex:1
Diffstat (limited to 'src/state/models/ui/saved-feeds.ts')
-rw-r--r--src/state/models/ui/saved-feeds.ts10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/state/models/ui/saved-feeds.ts b/src/state/models/ui/saved-feeds.ts
index 881684ee6..667bc03a3 100644
--- a/src/state/models/ui/saved-feeds.ts
+++ b/src/state/models/ui/saved-feeds.ts
@@ -95,19 +95,15 @@ export class SavedFeedsModel {
       return
     }
     if (direction === 'up' && index !== 0) {
-      const temp = pinned[index]
-      pinned[index] = pinned[index - 1]
-      pinned[index - 1] = temp
+      ;[pinned[index], pinned[index - 1]] = [pinned[index - 1], pinned[index]]
     } else if (direction === 'down' && index < pinned.length - 1) {
-      const temp = pinned[index]
-      pinned[index] = pinned[index + 1]
-      pinned[index + 1] = temp
+      ;[pinned[index], pinned[index + 1]] = [pinned[index + 1], pinned[index]]
     }
+    this._updatePinSortOrder(pinned.concat(this.unpinned.map(f => f.uri)))
     await this.rootStore.preferences.setSavedFeeds(
       this.rootStore.preferences.savedFeeds,
       pinned,
     )
-    this._updatePinSortOrder()
     track('CustomFeed:Reorder', {
       name: item.displayName,
       uri: item.uri,