-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
this will be useful for when subs use custom sort types. for example:
const userSelectedSortType = 'new'
let feed = useFeed({sortType: userSelectedSortType, subplebbitAddresses})
const firstAvailableSortTypeFeed = !feed.hasSortType && useFeed({sortType: feed.sortTypes[0], subplebbitAddresses})
if (firstAvailableSortTypeFeed) {
feed = firstAvailableSortTypeFeed
}This might not work with multiple subplebbits that all have different sort types.
so maybe it would be better to have something like useFeed({fallbackSortTypes: ['best', 'old', 'new', '*']}) or maybe just sortTypes: []
this should also be implemented in useReplies, though I guess the user could just check what sort type exists like
const userSelectedSortType = 'new'
const comment = useComment()
const sortType = (comment.replies?.pages?.[userSelectedSortType] || comment.replies?.pageCids?.[userSelectedSortType])
? userSelectedSortType
: Object.keys(comment.replies?.pages || {})[0] || Object.keys(comment.replies?.pageCids || {})[0]
const {replies} = useReplies({sortType})Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Todo