Improve types (#1921)

zio/stable
Eric Bailey 2023-11-15 19:23:59 -06:00 committed by GitHub
parent d8b26edb56
commit 8857ba70c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -31,7 +31,7 @@ export type UsePreferencesQueryResponse = Omit<
*/
contentLabels: Record<ConfigurableLabelGroup, LabelPreference>
feedViewPrefs: BskyFeedViewPreference & {
lab_mergeFeedEnabled: boolean
lab_mergeFeedEnabled?: boolean
}
/**
* User thread-view prefs, including newer fields that may not be typed yet.
@ -45,5 +45,5 @@ export type UsePreferencesQueryResponse = Omit<
export type ThreadViewPreferences = Omit<BskyThreadViewPreference, 'sort'> & {
sort: 'oldest' | 'newest' | 'most-likes' | 'random' | string
lab_treeViewEnabled: boolean
lab_treeViewEnabled?: boolean
}

View File

@ -296,7 +296,7 @@ function PostThreadLoaded({
post={item.post}
record={item.record}
dataUpdatedAt={dataUpdatedAt}
treeView={threadViewPrefs.lab_treeViewEnabled}
treeView={threadViewPrefs.lab_treeViewEnabled || false}
depth={item.ctx.depth}
isHighlightedPost={item.ctx.isHighlightedPost}
hasMore={item.ctx.hasMore}

View File

@ -48,7 +48,9 @@ export const HomeScreen = withAuthRequired(
if (!preferences) return {}
return {
mergeFeedEnabled: preferences.feedViewPrefs.lab_mergeFeedEnabled,
mergeFeedEnabled: Boolean(
preferences.feedViewPrefs.lab_mergeFeedEnabled,
),
mergeFeedSources: preferences.feeds.saved,
}
}, [preferences])