about summary refs log tree commit diff
path: root/src/state/models/post-thread-view.ts
diff options
context:
space:
mode:
authorJoão Ferreiro <ferreiro@pinkroom.dev>2022-11-29 10:29:19 +0000
committerJoão Ferreiro <ferreiro@pinkroom.dev>2022-11-29 10:29:19 +0000
commit77ea3bfd0a28f76651ed425cf733abcf01ecaa24 (patch)
tree53f6806d2ca00366f6f3298e378aa6a59ca17e83 /src/state/models/post-thread-view.ts
parent3ce113f1076bbeeffc20888b3a28b2680ada8ab5 (diff)
parent88c868dd808d204fc29deb162609de984745b951 (diff)
downloadvoidsky-77ea3bfd0a28f76651ed425cf733abcf01ecaa24.tar.zst
Merge branch 'main' into upload-image
Diffstat (limited to 'src/state/models/post-thread-view.ts')
-rw-r--r--src/state/models/post-thread-view.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/state/models/post-thread-view.ts b/src/state/models/post-thread-view.ts
index 70e34537f..5c0e0a4e8 100644
--- a/src/state/models/post-thread-view.ts
+++ b/src/state/models/post-thread-view.ts
@@ -1,5 +1,5 @@
 import {makeAutoObservable, runInAction} from 'mobx'
-import * as GetPostThread from '../../third-party/api/src/client/types/app/bsky/feed/getPostThread'
+import {AppBskyFeedGetPostThread as GetPostThread} from '../../third-party/api'
 import {AtUri} from '../../third-party/uri'
 import _omit from 'lodash.omit'
 import {RootStoreModel} from './root-store'
@@ -216,6 +216,7 @@ export class PostThreadViewModel {
   isRefreshing = false
   hasLoaded = false
   error = ''
+  notFound = false
   resolvedUri = ''
   params: GetPostThread.QueryParams
 
@@ -286,13 +287,15 @@ export class PostThreadViewModel {
     this.isLoading = true
     this.isRefreshing = isRefreshing
     this.error = ''
+    this.notFound = false
   }
 
-  private _xIdle(err: string = '') {
+  private _xIdle(err: any = undefined) {
     this.isLoading = false
     this.isRefreshing = false
     this.hasLoaded = true
-    this.error = err
+    this.error = err ? err.toString() : ''
+    this.notFound = err instanceof GetPostThread.NotFoundError
   }
 
   // loader functions
@@ -317,7 +320,7 @@ export class PostThreadViewModel {
       this._replaceAll(res)
       this._xIdle()
     } catch (e: any) {
-      this._xIdle(`Failed to load thread: ${e.toString()}`)
+      this._xIdle(e)
     }
   }