Skip to content

Commit

Permalink
Keep suggesting index on incoming message (#255)
Browse files Browse the repository at this point in the history
Fixes #254
  • Loading branch information
easafe authored Jun 24, 2024
1 parent 3a2edcc commit 2af910c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Client/Im/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,14 @@ receiveMessage

unsuggest Int ImModel ImModel
unsuggest userId model@{ suggestions, suggesting } = model
{ suggestions = DA.filter ((userId /= _) <<< _.id) suggestions
, suggesting = (\i → if i == 0 then 0 else i - 1) <$> suggesting
{ suggestions = updatedSuggestions
, suggesting = updatedSuggested
}
where
updatedSuggestions = DA.filter ((userId /= _) <<< _.id) suggestions
updatedSuggested
| DA.length suggestions == DA.length updatedSuggestions = suggesting
| otherwise = (max 0 <<< (_ - 1)) <$> suggesting

processIncomingMessage ClientMessagePayload ImModel Either Int ImModel
processIncomingMessage
Expand Down

0 comments on commit 2af910c

Please sign in to comment.