Skip to content

feat: implement offline message persistence and refined UI#1096

Open
deepak0x wants to merge 3 commits intoRocketChat:developfrom
deepak0x:feat/offline-message-handling
Open

feat: implement offline message persistence and refined UI#1096
deepak0x wants to merge 3 commits intoRocketChat:developfrom
deepak0x:feat/offline-message-handling

Conversation

@deepak0x
Copy link
Contributor

@deepak0x deepak0x commented Jan 23, 2026

This PR implements robust Offline Message Persistence along with a refined UI for failed message delivery. It ensures that messages sent while offline are not lost, allows users to recover them after a page reload, and provides a clear, intuitive interface for resending or deleting failed attempts.

Closes #1091


Screenshots/Video

Screencast.from.2026-01-23.22-34-23.online-video-cutter.com.mp4

Key Changes

1. Offline Persistence (localStorage)

  • Implemented localStorage-based caching for messages that fail to send.

  • Messages are partitioned by Room ID (rid), ensuring they only reappear in their respective channels.

  • Persisted messages are automatically re-injected into the message store during:

    • Initialization
    • Room switching
  • Added session cleanup logic to wipe offline caches on user logout.


2. Refined Message Sorting

  • Ensures global ordering consistency between:

    • Server-fetched messages
    • Locally recovered offline messages
  • Resend behavior: When a message is resent, its timestamp is updated to the current time, naturally moving it to the bottom of the chat.


3. UX & UI Improvements

  • Offline Indicator: Added a centered red RiWifiOffLine icon for messages that fail to send.

  • Custom Error Menu: Clicking the error icon opens an upward-positioned menu with:

    • Resend
    • Delete

deepak0x and others added 3 commits January 23, 2026 23:52
- Added localStorage-based message persistence partitioned by room ID.
- Implemented robust timestamp-based sorting for consistent message order.
- Added immediate offline detection and send failure handling.
- Introduced RiWifiOffLine icon with upward-opening Resend/Delete menu.
- Ensured resent messages move to the bottom of the chat list.
- Added session cleanup to clear offline messages on logout.
- Applied formatting and linting fixes.
@Spiral-Memory
Copy link
Collaborator

This looks good overall, but I’d prefer the Wi-Fi icon to be more understated - small and subtle, to give it a cleaner, more polished look.

import cloneArray from '../lib/cloneArray';
import { upsertMessage } from '../lib/messageListHelpers';

const PERSISTENCE_KEY = 'ec_offline_messages';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can we store somewhere globally instead of messageStore

languageName: node
linkType: hard

"react-icons@npm:^5.5.0":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use only the available icons, and generate them through the built-in icon tool from Rocket.Chat’s core system.

@Spiral-Memory Spiral-Memory added the nudge minor tweaks suggested label Mar 21, 2026
@deepak0x
Copy link
Contributor Author

sure
will fix and commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nudge minor tweaks suggested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Offline Message Handling and Resend/Delete UI

2 participants