Skip to content

Phase 8/9: optimistic reaction set fallback and pending cleanup#1237

Merged
osyed merged 11 commits intomainfrom
phase-8-reaction-set-rollback
Apr 13, 2026
Merged

Phase 8/9: optimistic reaction set fallback and pending cleanup#1237
osyed merged 11 commits intomainfrom
phase-8-reaction-set-rollback

Conversation

@dnlbui
Copy link
Copy Markdown
Collaborator

@dnlbui dnlbui commented Apr 10, 2026

Summary

This implements phase 8 reaction set behavior and the remaining phase 9 pending-result cleanup on top of the existing chat reaction flow.

The branch adds optimistic local handling for reaction set while keeping the previous reaction as hidden fallback until the pending transaction resolves. It also updates reaction rendering and chat-list preview logic so only the newest effective reaction per sender + targetTxid is shown, and completes pending success/failure/timeout reconciliation for those optimistic reactions.

What changed

  • add reactionTxId tracking on reaction entries
  • add optimistic outgoing reaction set handling with fallback preservation
  • reconcile pending reaction set success, failure, and timeout by txid
  • keep remove non-optimistic in phase 8/9
  • dedupe rendered and effective reactions so hidden fallback entries do not appear in chips or picker state
  • update chat-list preview and timestamp logic to compare newest valid reaction activity against newest non-deleted message activity
  • adjust delete and unread handling so deleting a reacted-to unread message clears both message unread and reaction unread when appropriate
  • play chat sound for incoming reaction updates that change effective state when the chat is inactive or hidden

Why

Phase 8 needs optimistic set behavior with rollback, but contact.reactions is also used by chat previews and reaction chips. The branch preserves the previous reaction only as temporary fallback state and makes the UI treat the newest entry for each sender + targetTxid as the effective reaction. It also closes the follow-up pending-result work that phase 9 was left to cover.

Validation

  • node --check app.js
  • local branch review against main

Notes

  • this PR keeps reaction remove non-optimistic
  • the two untracked design docs in the local worktree were not included in the PR

dnlbui added 10 commits April 9, 2026 18:15
…fective reaction management. Added support for optional properties in reaction updates, improved filtering of duplicate reactions, and implemented methods for purging and removing reactions based on transaction IDs. Updated existing functions to utilize these enhancements, ensuring accurate representation of user interactions and improved UI synchronization after reaction state changes.
… count management. Updated logic to accurately adjust unread reaction notifications based on effective reactions, enhancing user experience in active chats.
… to accurately adjust unread counts for incoming messages. Improved handling of unread notifications based on message deletion context, ensuring a better user experience in chat interactions.
…MessageActivity` function to streamline retrieval of the most recent non-deleted message for chat list display. Updated related logic in `ChatsScreen` to enhance clarity and maintainability, ensuring accurate representation of chat activity.
…ondition to play a sound when the sender is the current user and the chat is inactive or the document is hidden. This improves user engagement by providing audio feedback for reactions in non-active chat contexts.
…st activity if no recent activity is found. This change ensures that chats with no recent messages are still displayed, improving user visibility of all contacts.
… amounts from unread count calculations. This adjustment enhances the accuracy of unread message detection in chat interactions.
…ticReactionSet` function. This function manages outgoing reactions while preserving previous reactions as fallback, ensuring accurate updates and preventing duplicates. Updated related logic in `applyIncomingReaction` to streamline reaction processing and enhance user experience in chat interactions.
…y and accuracy. Added comments to clarify unread message checks and streamlined logic for determining unread messages in inactive chats, enhancing user experience in chat interactions.
…. Renamed variables for better readability and updated return types in `applyOptimisticReactionSet` to enhance the accuracy of reaction state updates. Streamlined duplicate reaction checks across multiple functions, ensuring efficient processing of contact reactions.
@dnlbui dnlbui marked this pull request as ready for review April 10, 2026 16:54
@dnlbui dnlbui changed the title Phase 8: optimistic reaction set fallback handling Phase 8/9: optimistic reaction set fallback and pending cleanup Apr 10, 2026
…ions. Introduced overrides for network queries and transaction injections to facilitate testing. Enhanced feedback for failed reactions and timeouts by displaying appropriate toast notifications, ensuring better user awareness of reaction states.
@osyed osyed merged commit a474d1c into main Apr 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 8: Persist reaction rollback state across inject failure and restart Phase 9: Complete pending reaction result handling

2 participants