Skip to content

Commit

Permalink
Fixes remember of the wrong hashtag because it's a different post.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Jan 18, 2024
1 parent 0babc46 commit b8f3625
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ fun DisplayFollowingHashtagsInPost(
accountViewModel: AccountViewModel,
nav: (String) -> Unit,
) {
val noteEvent = remember { baseNote.event } ?: return

val userFollowState by accountViewModel.userFollows.observeAsState()
var firstTag by remember { mutableStateOf<String?>(null) }
var firstTag by remember(baseNote) { mutableStateOf<String?>(null) }

LaunchedEffect(key1 = userFollowState) {
launch(Dispatchers.Default) {
val followingTags = userFollowState?.user?.cachedFollowingTagSet() ?: emptySet()
val newFirstTag = noteEvent.firstIsTaggedHashes(followingTags)
val newFirstTag = baseNote.event?.firstIsTaggedHashes(followingTags)

if (firstTag != newFirstTag) {
launch(Dispatchers.Main) { firstTag = newFirstTag }
Expand Down

0 comments on commit b8f3625

Please sign in to comment.