From fce03e1046ccc31e34d31d3ccafe0fbeb826525f Mon Sep 17 00:00:00 2001 From: rajdubey Date: Mon, 16 Nov 2026 17:59:02 +0530 Subject: [PATCH 01/13] docs(react): offline support for the React UI Kit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WEaVigCRBjkftm78T25MQA --- docs.json | 1 + ui-kit/react/core-features.mdx | 15 +- ui-kit/react/llms-react-v7.mdx | 1 + ui-kit/react/offline-support.mdx | 394 +++++++++++++++++++++++++++++++ 4 files changed, 410 insertions(+), 1 deletion(-) create mode 100644 ui-kit/react/offline-support.mdx diff --git a/docs.json b/docs.json index 40eea0779..7cf566d09 100644 --- a/docs.json +++ b/docs.json @@ -459,6 +459,7 @@ "group": "Chat", "pages": [ "ui-kit/react/core-features", + "ui-kit/react/offline-support", "ui-kit/react/extensions", "ui-kit/react/ai-features" ] diff --git a/ui-kit/react/core-features.mdx b/ui-kit/react/core-features.mdx index 3dc088979..07564b317 100644 --- a/ui-kit/react/core-features.mdx +++ b/ui-kit/react/core-features.mdx @@ -9,7 +9,7 @@ description: "Overview of CometChat React UI Kit core features, including messag | --- | --- | | Package | `@cometchat/chat-uikit-react` | | Required setup | Wrap app in `CometChatProvider` with valid credentials — must complete before rendering any component | -| Core features | Instant Messaging, Media Sharing, Read Receipts, Mark as Unread, Typing Indicator, User Presence, Reactions, Mentions, Quoted Reply, Pin & Save Messages, Search, Threaded Conversations, Moderation, Report Message, Group Chat | +| Core features | Instant Messaging, Media Sharing, Read Receipts, Mark as Unread, Typing Indicator, User Presence, Reactions, Mentions, Quoted Reply, Pin & Save Messages, Search, Threaded Conversations, Moderation, Report Message, Group Chat, Offline Support | | Key components | `CometChatConversations` → [Conversations](/ui-kit/react/components/conversations), `CometChatMessageList` → [Message List](/ui-kit/react/components/message-list), `CometChatMessageComposer` → [Message Composer](/ui-kit/react/components/message-composer), `CometChatMessageHeader` → [Message Header](/ui-kit/react/components/message-header), `CometChatUsers` → [Users](/ui-kit/react/components/users), `CometChatGroups` → [Groups](/ui-kit/react/components/groups), `CometChatGroupMembers` → [Group Members](/ui-kit/react/components/group-members) | | CSS class prefix | `.cometchat-` | | Theming | Override CSS variables on `.cometchat` class. See [Theming](/ui-kit/react/theming) | @@ -308,6 +308,19 @@ Search requires wiring the result callbacks to navigation: handle `onConversatio See the [Groups](/ui-kit/react/components/groups) component page for details. +## Offline Support + +With offline support turned on, chats and messages the user has already opened appear at once from a cache on the device, messages sent while offline are queued and sent automatically on reconnect, and each list tells the user when something needs a connection ("Connect to load chats", "Connect to search", "Connect to load more"). Offline support is off by default; turn it on with `setOfflineConfig()` on the `UIKitSettingsBuilder`. It needs React UI Kit 7.3.0 and JavaScript Chat SDK 4.3.0 or later. + +| Components | Functionality | +| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| [Conversations](/ui-kit/react/components/conversations) | Shows saved conversations first, then merges in the server's list. Shows a notice if unsent messages were lost in a cache reset. | +| [Message List](/ui-kit/react/components/message-list) | Opens chats from the cache, marks queued and failed messages, and offers Retry and Delete on unsent messages. | +| [Message Composer](/ui-kit/react/components/message-composer) | Queues text, media, voice notes and stickers sent while offline. | +| [Users](/ui-kit/react/components/users), [Groups](/ui-kit/react/components/groups), [Group Members](/ui-kit/react/components/group-members) | Show saved rows first, and "Connect to load …" or "Connect to search" when nothing is saved. | + +See [Offline Support](/ui-kit/react/offline-support) for setup, the offline states and texts, events and customization. + --- ## Next Steps diff --git a/ui-kit/react/llms-react-v7.mdx b/ui-kit/react/llms-react-v7.mdx index d5ac71012..98c48b5ff 100644 --- a/ui-kit/react/llms-react-v7.mdx +++ b/ui-kit/react/llms-react-v7.mdx @@ -48,6 +48,7 @@ components, theming tokens, or feature enablement. ## Core & configuration - [CometChatProvider](/ui-kit/react/cometchat-provider) - [Core Features](/ui-kit/react/core-features) +- [Offline Support (cache, queued sends, offline states)](/ui-kit/react/offline-support) - [Methods](/ui-kit/react/methods) - [Event System](/ui-kit/react/event-system) - [Sound Manager](/ui-kit/react/sound-manager) diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx new file mode 100644 index 000000000..46dec490f --- /dev/null +++ b/ui-kit/react/offline-support.mdx @@ -0,0 +1,394 @@ +--- +title: "Offline Support" +sidebarTitle: "Offline Support" +description: "Show saved chats and messages without a network, queue sends until the connection returns, and customize the offline states of the CometChat React UI Kit." +--- + + + +| Field | Value | +| --- | --- | +| Package | `@cometchat/chat-uikit-react` 7.3.0 or later, with `@cometchat/chat-sdk-javascript` 4.3.0 or later | +| Default | **Off.** Nothing changes until you call `setOfflineConfig()` with `enabled: true` | +| Enable | `new UIKitSettingsBuilder()...setOfflineConfig({ enabled: true }).build()`, then `CometChatUIKit.init(settings)` | +| Config | Passed to the SDK's `AppSettingsBuilder.setOfflineConfig()` unchanged. Options: [Configuration & API Reference](/sdk/javascript/offline-reference#offlineconfig-options) | +| Runtime check | `CometChat.isOfflineEnabled()` from `@cometchat/chat-sdk-javascript` | +| Props | `hideOfflineNotices` on `CometChatMessageList` and `CometChatConversations` (default `false`) | +| Events | `ui:message/send-state-changed`, `ui:offline/cache-reset` via `useCometChatEvents` | +| Send promise | `CometChatUIKit.sendTextMessage` / `sendMediaMessage` / `sendCustomMessage` resolve when sent; a logout or cache reset rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` | +| Styling | `--cometchat-message-bubble-offline-*`, `--cometchat-message-list-offline-*`, `--cometchat-conversations-offline-*`, `--cometchat-offline-media-unavailable-*` CSS variables | + + + +With offline support turned on, the React UI Kit keeps working when the network drops. Chats and messages the user has already opened load from a cache on the device at once, messages sent while offline wait in a queue and go out when the connection returns, and every list says plainly when something needs a connection. + +The UI Kit builds on [offline support in the JavaScript SDK](/sdk/javascript/offline-overview). You turn it on once in `UIKitSettings`; the components handle the rest. + +## Overview + +**Works offline** + +- Conversations, users, groups, group members, messages, reactions, notifications, and pinned and saved messages the user has already loaded appear straight away from the cache. +- Messages the user sends (text, media, custom and stickers) are queued and sent automatically on reconnect. +- Media that was downloaded while online is shown from the device. +- When the connection returns, the SDK catches up on what was missed and the lists update in place. + +**Needs a connection** + +- Anything the user has never opened while online, for example the first load of a chat or a list. +- Keyword search with no saved match, and the Search screen. +- Edits, deletes, reactions and other actions on messages that are already sent. They are not queued. (Retry and Delete on a message that is not sent yet work offline.) +- Calls, call logs, message information and AI features such as streamed replies. + +## Requirements + +| Requirement | Version | +| --- | --- | +| React UI Kit | `@cometchat/chat-uikit-react` **7.3.0** or later | +| JavaScript Chat SDK | `@cometchat/chat-sdk-javascript` **4.3.0** or later | +| React | 18 or later (the UI Kit's peer range is `>=18.0.0 <21.0.0`) | + +The UI Kit's peer dependency on the Chat SDK stays `^4.2.0`, so upgrading the UI Kit does not force an SDK upgrade. On an SDK older than 4.3.0, `setOfflineConfig()` has no effect and the UI Kit works online as before. Install 4.3.0 or later to use offline support: + +```bash +npm install @cometchat/chat-uikit-react@^7.3.0 @cometchat/chat-sdk-javascript@^4.3.0 +``` + +Offline support is for UI Kit v7 only. UI Kit v6 and earlier have no offline UI, and turning on the SDK's offline support with them is not supported. + +For the browsers and storage the SDK uses for its cache, see [Supported runtimes](/sdk/javascript/offline-enable#supported-runtimes). + +## Enable Offline Support + +Offline support is **off by default**. Call `setOfflineConfig()` on the `UIKitSettingsBuilder` before `CometChatUIKit.init()`, and set `enabled: true`. + +```tsx title="src/main.tsx" +import ReactDOM from "react-dom/client"; +import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react"; +import App from "./App"; + +const settings = new UIKitSettingsBuilder() + .setAppId("APP_ID") + .setRegion("REGION") + .setAuthKey("AUTH_KEY") + .subscribePresenceForAllUsers() + .setOfflineConfig({ + enabled: true, + // Optional. Every key below has a default in the SDK: + // maxPendingMessages: 50, + // mediaCaching: "AUTO", + // encryption: true, + }) + .build(); + +CometChatUIKit.init(settings).then(async () => { + await CometChatUIKit.login("cometchat-uid-1"); + ReactDOM.createRoot(document.getElementById("root")!).render(); +}); +``` + +The UI Kit passes the object to the SDK's `AppSettingsBuilder.setOfflineConfig()` unchanged. Its type, `CometChatOfflineConfig`, is exported from `@cometchat/chat-uikit-react` and lists the same keys as the SDK's `OfflineConfig`, so a misspelled key is a compile error. For what each key does and its default (cache size, outbox size, media caching, encryption and so on), see [OfflineConfig options](/sdk/javascript/offline-reference#offlineconfig-options). + + +Offline turns on only for an explicit `enabled: true`. If you don't call `setOfflineConfig()`, or pass a config without `enabled: true`, the UI Kit behaves exactly as it does today. + + +Whether offline support is actually running can change after init. For example, it is off before anyone logs in, and when the encrypted cache cannot open. To check it in your own code, call `CometChat.isOfflineEnabled()` at the moment you need the answer rather than reading back the config you passed. See [Verify it is active](/sdk/javascript/offline-enable). + +## How the Components Behave Offline + +### Lists + +[Conversations](/ui-kit/react/components/conversations), [Users](/ui-kit/react/components/users), [Groups](/ui-kit/react/components/groups), [Group Members](/ui-kit/react/components/group-members), [Reaction List](/ui-kit/react/components/reaction-list), [Notification Feed](/ui-kit/react/components/notification-feed), [Pinned Messages](/ui-kit/react/components/pinned-messages) and [Saved Messages](/ui-kit/react/components/saved-messages) all load in two steps: + +1. The saved rows paint first, from the cache. +2. The server's page then replaces them in place when it arrives. + +When a load can't reach the server: + +| Situation | What the list shows | `onError` | +| --- | --- | --- | +| Rows are on screen, offline | The rows stay. No error view. | Not called | +| Nothing on screen, offline | An icon and "Connect to load chats" (or users, groups, members, messages, reactions, notifications), with no Retry button. The list loads again once by itself on reconnect. | Called once | +| Nothing on screen, offline, keyword search | "Connect to search" with a second line, "Search needs an internet connection." The search runs again once on reconnect. | Not called | +| Nothing on screen, online, a real error | The usual error view. It does not reload by itself. | Called | +| The server answered with nothing | The usual empty view | Not called | + +A list opened with only a filter (for example online users only, tags, or a request builder with no keyword) is a plain list, not a search. Offline with nothing saved, it says "Connect to load …", never "Connect to search". + +If you pass your own `errorView` (or `emptyView` for a keyword search), your view is shown instead of the offline state. See [Customization](#customization). + +### Search + +The [Search](/ui-kit/react/components/search) component needs a connection for keyword search: + +- Offline, with nothing shown, a keyword search shows "Connect to search" and "Search needs an internet connection." +- A search by filter alone is answered from the device. With nothing saved it shows the plain "No results" state, with no `onError`. +- When both conversation and message results fail and at least one failure is a real error (not a lost connection), the error view shows and `onError` is called. + +### Message list and threads + +- A chat opens with its cached messages, then the server's page merges in. +- A chat opened offline with nothing saved shows "Connect to load messages". It is read again once when the connection returns. +- At an edge the cache can't fill (older history, or newer messages after jumping to a message), the list shows a "Connect to load more" row. The row is a button, and it also loads by itself once when the connection returns. +- Jumping to a message (from a search result, a quoted reply or the first unread message) works offline when that message is saved. If it isn't, the chat opens on its newest saved messages instead. +- After a long outage the catch-up may bring more than a page of new messages. While the user is reading older messages, a **Jump to latest** button appears instead of moving the list. + + +The default message list asks the server for pages in the form the SDK caches, then applies its message types, categories and hide-deleted setting on the device. If you pass your own `messagesRequestBuilder`, it is sent as you built it, and its pages are cached only when `hideReplies` is its only content filter. + + +### Composer and sending + +- A message sent while offline appears in the list at once with a clock icon and the label "Not sent yet". It is sent automatically when the connection returns, and its receipt then updates as usual. +- A message that fails shows an error mark and a **Not sent. Tap to retry** button under the bubble. The failed state survives a page reload. +- The message menu of an unsent or failed message offers only **Retry** and **Delete**. Actions that need a server copy (reply, edit, react and so on) are hidden until it is sent. **Delete** removes the message from this device. It is hidden when `hideDeleteMessageOption` is set. +- Retry or Delete on a message whose send is already under way changes nothing and shows "Sending… try again in a moment". +- If the outbox is full, the send is refused and the list shows "Too many messages waiting to send". A file larger than the media cache limit is refused with "File too large to send offline". See [Queue limits](/sdk/javascript/offline-send#queue-limits). +- In the [attachment staging tray](/ui-kit/react/components/message-composer#multi-attachment-staging-tray), a file whose upload stopped because the connection dropped is not treated as a bad file: pressing Send queues it with the rest of the message. +- Voice notes, stickers and the group call message queue like any other send. + +### Media + +With media caching on (the SDK default), images, videos, audio and files that were downloaded while online are shown from the device. A media bubble whose file is not saved shows "Available when online" while the device is offline. Tapping it asks the SDK to download the file, and the bubble updates once it is saved. See [Media Caching](/sdk/javascript/offline-media-caching). + +### Edits, deletes and reactions + +These are not queued. They are sent as soon as the user acts, and they fail if there is no connection: + +- **Reactions** show at once, then roll back and call the message list's `onError` if the request fails. +- **Deleting** a sent message calls `onError` if it fails, and the message stays. +- **Editing** a message keeps the edited text in the composer, still in edit mode, so the user can try again. `onError` is called. + +See [Edits, Deletes, and Reactions Need a Connection](/sdk/javascript/offline-send#edits-deletes-and-reactions-need-a-connection). + +### Presence + +While the SDK is disconnected, nobody shows as online: no online dot, no "Online" subtitle and no typing indicator, in any list or header, and screen readers are told the same. Presence comes back after the reconnect. + +### Logout, user switch and cache reset + +The cache is per user. A logout or a switch to another user clears every list on screen, and the SDK deletes that user's cached data and queued messages. + +If the SDK has to wipe and rebuild its cache (for example when the encryption key is lost), every mounted list reloads. If unsent messages were lost, a notice such as "2 unsent messages couldn't be recovered" appears once, in the Conversations list or the open Message List. See [When the cache resets](/sdk/javascript/offline-sync#when-the-cache-resets). + +## Offline States and Texts + +The texts are the same in every CometChat UI Kit. Override any of them with [custom translations](/ui-kit/react/localization#adding-custom-translations). + +| Text (en-US) | Where it appears | Localization key | +| --- | --- | --- | +| Connect to load chats | Conversations, offline with nothing saved | `conversations_connect_to_load` | +| Connect to load users | Users | `users_connect_to_load` | +| Connect to load groups | Groups | `groups_connect_to_load` | +| Connect to load members | Group Members | `group_members_connect_to_load` | +| Connect to load messages | Message List, Pinned Messages, Saved Messages | `message_list_connect_to_load` | +| Connect to load reactions | Reaction List | `reaction_list_connect_to_load` | +| Connect to load notifications | Notification Feed | `notifications_connect_to_load` | +| Connect to search | Conversations, Users, Groups, Group Members: keyword search offline | `search_connect_to_search` | +| Connect to search | Search component | `search_connect_to_search_messages` | +| Search needs an internet connection. | Second line under "Connect to search" | `search_connect_to_search_subtitle` | +| Connect to load more | Message List edge row (older messages) | `message_list_connect_to_load_more` | +| Connect to load more | Message List edge row (newer messages) | `message_list_connect_to_load_newer` | +| Jump to latest | Message List, after a large catch-up | `message_list_jump_to_latest` | +| Not sent yet | Label of a queued message's clock icon | `message_list_not_sent_yet` | +| Not sent. Tap to retry | Button and label on a failed message | `message_list_not_sent_tap_to_retry` | +| Available when online | Media bubble whose file is not saved | `message_bubble_media_available_when_online` | +| Too many messages waiting to send | Message List notice | `message_list_queue_full` | +| File too large to send offline | Message List notice | `message_list_file_too_large_offline` | +| Sending… try again in a moment | Message List notice | `message_list_send_in_flight` | +| 1 unsent message was removed | Message List notice | `message_list_unsent_message_removed` | +| `{{count}}` message(s) weren't sent | Message List notice | `message_list_messages_not_sent_one`, `message_list_messages_not_sent_other` | +| `{{count}}` unsent message(s) couldn't be recovered | Conversations or Message List notice after a cache reset | `message_list_unsent_messages_lost_one`, `message_list_unsent_messages_lost_other` | +| Some unsent messages may not have been sent | Conversations or Message List notice after a cache reset | `message_list_unsent_messages_maybe_lost` | + +Count texts have plural forms: the UI Kit picks `_one`, `_other` (and `_few` / `_many` where a language needs them) for the current language, and replaces `{{count}}` with the number. + +```tsx +import { CometChatLocalize } from "@cometchat/chat-uikit-react"; + +const localize = CometChatLocalize.getSharedInstance(); +localize?.addTranslation("en-us", { + conversations_connect_to_load: "You're offline. Chats will load when you reconnect.", + message_list_not_sent_yet: "Waiting for network", +}); +``` + +## Errors and Callbacks + +### `onError` + +- **Rows on screen:** offline, a failed load is silent (no error view, no `onError`). A real error calls `onError` once when the user or your app started the load (opening the list, refreshing, searching, paging), and stays silent when the UI Kit started it (reconnect, coming back to the foreground, sync). +- **Nothing on screen:** see the [Lists](#lists) table. +- **Actions:** a failed reaction, delete or edit calls `onError`, as above. + +### Send promises + +`CometChatUIKit.sendTextMessage()`, `sendMediaMessage()` and `sendCustomMessage()` answer every send: + +- Queueing a message does not reject the promise. It resolves when the message is sent and rejects on a final failure. +- A logout or user switch, a cache reset that loses the unsent messages, or the SDK removing the message rejects the promise once with an error whose `code` is `ERROR_OFFLINE_MESSAGE_DISCARDED`. +- The UI Kit shows nothing for that rejection: no error toast, no `onError`, and the composer does not lock. Only your own `.catch` hears of it. + +```tsx +import { CometChat } from "@cometchat/chat-sdk-javascript"; +import { CometChatUIKit } from "@cometchat/chat-uikit-react"; + +const message = new CometChat.TextMessage("cometchat-uid-2", "Hello!", CometChat.RECEIVER_TYPE.USER); + +CometChatUIKit.sendTextMessage(message) + .then((sent) => console.log("Sent", sent.getId())) + .catch((error) => { + if (error?.code === "ERROR_OFFLINE_MESSAGE_DISCARDED") { + // Logged out, switched user or cache reset before it could send. + return; + } + console.error("Send failed", error); + }); +``` + +With offline off, these methods behave as before. + +### Events + +Two UI events are added to the [event system](/ui-kit/react/event-system). Both fire only with offline support on. + +| Event | Payload | When | +| --- | --- | --- | +| `ui:message/send-state-changed` | `{ message, state, reason? }` | An own message's send state changed. `state` is a `CometChatMessageSendState`: `"sending"` (queued or in flight), `"sent"`, `"failed"` (Retry offered) or `"discarded"` (removed before it was sent). `reason` is the SDK's `MessageFailureReason` for `failed` and `discarded`. Fired once per change per message. | +| `ui:offline/cache-reset` | `{ reason, pendingMessagesLost }` | The SDK wiped and rebuilt its cache. Every mounted list reloads. `pendingMessagesLost` is the number of unsent messages that could not be kept, or `null` when unknown. | + +`ui:message/sent` keeps its meaning and still fires for each send. + +```tsx +import { useCometChatEvents } from "@cometchat/chat-uikit-react"; + +function OfflineSendTracker() { + useCometChatEvents((event) => { + switch (event.type) { + case "ui:message/send-state-changed": + console.log(event.message.getMuid(), event.state, event.reason); + break; + case "ui:offline/cache-reset": + console.log("Cache reset", event.reason, event.pendingMessagesLost); + break; + default: + break; + } + }, []); + + return null; +} +``` + + +These events are new members of the exported `CometChatEvent` union. If your TypeScript code has an exhaustive `switch` on `event.type` with no `default`, add one. + + +## Customization + +### Hide the offline notices + +| Component | Prop | Default | Hides | +| --- | --- | --- | --- | +| [Message List](/ui-kit/react/components/message-list) | `hideOfflineNotices` | `false` | The notices about unsent messages: removed, not sent, lost in a cache reset, outbox full, file too large, send under way | +| [Conversations](/ui-kit/react/components/conversations) | `hideOfflineNotices` | `false` | The notice shown after a cache reset lost, or may have lost, unsent messages | + +```tsx + + +``` + +### Use your own offline view + +The lists show your own `errorView` instead of "Connect to load …", and your own `emptyView` instead of "Connect to search". To tell the offline state apart inside your view, read `connectToLoad` or `connectToSearch` from the component's context hook. They are `true` only while the offline state is shown, and never set with offline off. + +| Context hook | `connectToLoad` | `connectToSearch` | +| --- | --- | --- | +| `useCometChatConversationsContext` | Yes | Yes | +| `useCometChatUsersContext` | Yes | Yes | +| `useCometChatGroupsContext` | Yes | Yes | +| `useCometChatGroupMembersContext` | Yes | Yes | +| `useCometChatReactionListContext` | Yes | No | +| `useCometChatNotificationFeedContext` | Yes | No | +| `useCometChatPinnedMessagesContext` | Yes | No | +| `useCometChatSavedMessagesContext` | Yes | No | +| `useCometChatSearchContext` | No | Yes | + +### Style the offline UI + +Each variable falls back to the UI Kit's current theme value, so set only what you want to change. See [Theming](/ui-kit/react/theming). + +| CSS variable | Styles | Falls back to | +| --- | --- | --- | +| `--cometchat-message-bubble-offline-retry-color` | "Not sent. Tap to retry" text | `--cometchat-error-color` | +| `--cometchat-message-bubble-offline-retry-font` | "Not sent. Tap to retry" font | `--cometchat-font-caption1-regular` | +| `--cometchat-message-bubble-offline-retry-focus-outline-color` | Focus ring of the retry button | `--cometchat-primary-color` | +| `--cometchat-message-bubble-offline-failed-icon-color` | Error mark on a failed message | `--cometchat-error-color` | +| `--cometchat-message-bubble-offline-failed-tint` | Background of a failed message's row | `transparent` | +| `--cometchat-message-list-offline-footer-color` | "Connect to load more" text | `--cometchat-text-color-highlight` | +| `--cometchat-message-list-offline-footer-font` | "Connect to load more" font | `--cometchat-font-caption1-regular` | +| `--cometchat-message-list-offline-notice-background` | Message List notice background | `--cometchat-neutral-color-300` | +| `--cometchat-message-list-offline-notice-color` | Message List notice text | `--cometchat-text-color-secondary` | +| `--cometchat-message-list-offline-notice-font` | Message List notice font | `--cometchat-font-caption1-regular` | +| `--cometchat-conversations-offline-notice-background` | Conversations notice background | `--cometchat-neutral-color-300` | +| `--cometchat-conversations-offline-notice-color` | Conversations notice text | `--cometchat-text-color-secondary` | +| `--cometchat-conversations-offline-notice-font` | Conversations notice font | `--cometchat-font-caption1-regular` | +| `--cometchat-offline-media-unavailable-background` | "Available when online" background | `--cometchat-neutral-color-300` | +| `--cometchat-offline-media-unavailable-color` | "Available when online" text | `--cometchat-text-color-secondary` | +| `--cometchat-offline-media-unavailable-font` | "Available when online" font | `--cometchat-font-caption1-regular` | + +```css +.cometchat { + --cometchat-message-bubble-offline-failed-tint: rgba(244, 70, 73, 0.06); + --cometchat-message-list-offline-footer-color: #6852d6; +} +``` + +## With Offline Support Turned Off + +Apps that don't call `setOfflineConfig()` get no offline UI, no offline events and no change to how sends work. A few fixes in the same release do change what every app sees: + +- A message list that is empty when the connection returns now loads again and shows its empty state, instead of staying blank. +- A reconnect while the newest message is still unsent now fetches the messages missed during the outage. +- Paging past a conversation that just received a message no longer shows it twice. +- A `messagesRequestBuilder` you pass to `CometChatMessageList` or `CometChatSavedMessages` is no longer modified. +- Saved Messages rows are no longer announced to screen readers as selectable options. +- Message rows, conversation rows, notices, the composer input and the empty and error views carry new `data-cc` attributes for test automation. Existing `data-testid` and `data-message-id` attributes are kept, but DOM snapshot tests may change. + +## Limitations and Known Issues + +- **Only what was loaded online is saved.** A user who has never opened a chat or list while online has nothing to show offline. +- **Thread replies opened online are not saved for offline.** Replies sent or received on this device are saved. +- **A lost send acknowledgement can create one duplicate** of that message on the server. +- **Missed messages can take up to about 10 seconds** to appear after a quick reconnect. +- **After a page reload, a failed message's reason may be unknown.** It is still offered Retry. +- **A chat can stall while online** if a send got no answer while connected. It resumes at the next reconnect. +- **Multiple tabs:** a cache rebuild in one tab can discard another tab's unsent messages. That tab's rows update to match. +- **Need a connection:** keyword search, message information, call logs and AI streamed replies. Call logs have no saved copy and keep their own error view. +- **Encryption in the browser** covers the cached content but not its lookup metadata, and downloaded media is stored unencrypted. See [Encrypt the Cache](/sdk/javascript/offline-encryption). + +--- + +## Next Steps + + + + How the cache, outbox and catch-up sync work + + + Every `OfflineConfig` option, listener and error code + + + Queued sends, retry, discard and queue limits + + + Subscribe to UI Kit events with `useCometChatEvents` + + + Override the offline texts + + + See how the components power each chat feature + + From 64b01095b4354ad5ac872ea42fd5b35e010ecad2 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Wed, 18 Nov 2026 00:37:51 +0530 Subject: [PATCH 02/13] docs: a failed edit clears the composer, as on Android Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XbguTt1cqFxTDQyroF6wHx --- ui-kit/react/offline-support.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 46dec490f..a24ed959f 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -158,7 +158,7 @@ These are not queued. They are sent as soon as the user acts, and they fail if t - **Reactions** show at once, then roll back and call the message list's `onError` if the request fails. - **Deleting** a sent message calls `onError` if it fails, and the message stays. -- **Editing** a message keeps the edited text in the composer, still in edit mode, so the user can try again. `onError` is called. +- **Editing** a message: the composer clears and leaves edit mode when the user sends the edit. If the edit fails, the message keeps its old text and `onError` is called. See [Edits, Deletes, and Reactions Need a Connection](/sdk/javascript/offline-send#edits-deletes-and-reactions-need-a-connection). From f8334fcf08551667f6bda63f849c5f38d17adad5 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Thu, 19 Nov 2026 16:57:01 +0530 Subject: [PATCH 03/13] docs(ENG-57590): correct the React offline page against 7.3.0 Update the jump-to-unsaved-message, edit failure, send promise, presence, reaction list and Retry/Delete behaviour to match the UI Kit, fix the encryption default in the example and the addTranslation() call, drop the Search context row (it exposes no offline flags), add the message list context and the delete-failed text, and stop promising that media and voice notes picked offline are queued. Co-Authored-By: Claude Opus 5.5 Co-authored-by: multica-agent --- ui-kit/react/core-features.mdx | 2 +- ui-kit/react/offline-support.mdx | 46 +++++++++++++++++++------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/ui-kit/react/core-features.mdx b/ui-kit/react/core-features.mdx index 07564b317..bd53cd13d 100644 --- a/ui-kit/react/core-features.mdx +++ b/ui-kit/react/core-features.mdx @@ -316,7 +316,7 @@ With offline support turned on, chats and messages the user has already opened a | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | [Conversations](/ui-kit/react/components/conversations) | Shows saved conversations first, then merges in the server's list. Shows a notice if unsent messages were lost in a cache reset. | | [Message List](/ui-kit/react/components/message-list) | Opens chats from the cache, marks queued and failed messages, and offers Retry and Delete on unsent messages. | -| [Message Composer](/ui-kit/react/components/message-composer) | Queues text, media, voice notes and stickers sent while offline. | +| [Message Composer](/ui-kit/react/components/message-composer) | Queues text messages and stickers sent while offline. | | [Users](/ui-kit/react/components/users), [Groups](/ui-kit/react/components/groups), [Group Members](/ui-kit/react/components/group-members) | Show saved rows first, and "Connect to load …" or "Connect to search" when nothing is saved. | See [Offline Support](/ui-kit/react/offline-support) for setup, the offline states and texts, events and customization. diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index a24ed959f..1832432d7 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -15,7 +15,7 @@ description: "Show saved chats and messages without a network, queue sends until | Runtime check | `CometChat.isOfflineEnabled()` from `@cometchat/chat-sdk-javascript` | | Props | `hideOfflineNotices` on `CometChatMessageList` and `CometChatConversations` (default `false`) | | Events | `ui:message/send-state-changed`, `ui:offline/cache-reset` via `useCometChatEvents` | -| Send promise | `CometChatUIKit.sendTextMessage` / `sendMediaMessage` / `sendCustomMessage` resolve when sent; a logout or cache reset rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` | +| Send promise | `CometChatUIKit.sendTextMessage` / `sendMediaMessage` / `sendCustomMessage` resolve when sent; a logout, user switch or cache reset rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` | | Styling | `--cometchat-message-bubble-offline-*`, `--cometchat-message-list-offline-*`, `--cometchat-conversations-offline-*`, `--cometchat-offline-media-unavailable-*` CSS variables | @@ -29,14 +29,14 @@ The UI Kit builds on [offline support in the JavaScript SDK](/sdk/javascript/off **Works offline** - Conversations, users, groups, group members, messages, reactions, notifications, and pinned and saved messages the user has already loaded appear straight away from the cache. -- Messages the user sends (text, media, custom and stickers) are queued and sent automatically on reconnect. +- Text messages, stickers and custom messages the user sends are queued and sent automatically on reconnect. - Media that was downloaded while online is shown from the device. - When the connection returns, the SDK catches up on what was missed and the lists update in place. **Needs a connection** - Anything the user has never opened while online, for example the first load of a chat or a list. -- Keyword search with no saved match, and the Search screen. +- Keyword search with no saved match, and keyword search in the Search component. - Edits, deletes, reactions and other actions on messages that are already sent. They are not queued. (Retry and Delete on a message that is not sent yet work offline.) - Calls, call logs, message information and AI features such as streamed replies. @@ -74,10 +74,10 @@ const settings = new UIKitSettingsBuilder() .subscribePresenceForAllUsers() .setOfflineConfig({ enabled: true, - // Optional. Every key below has a default in the SDK: + // Optional. Every other key has a default in the SDK, for example: // maxPendingMessages: 50, // mediaCaching: "AUTO", - // encryption: true, + // encryption: false, }) .build(); @@ -114,8 +114,12 @@ When a load can't reach the server: | Nothing on screen, online, a real error | The usual error view. It does not reload by itself. | Called | | The server answered with nothing | The usual empty view | Not called | +Pinned Messages and Saved Messages have no `onError` prop; the `onError` column applies to the other lists. + A list opened with only a filter (for example online users only, tags, or a request builder with no keyword) is a plain list, not a search. Offline with nothing saved, it says "Connect to load …", never "Connect to search". +While the Reaction List shows "Connect to load reactions", its tabs still show the message's own counts ("All" and one tab per emoji). The reactors fill in once the list can load. + If you pass your own `errorView` (or `emptyView` for a keyword search), your view is shown instead of the offline state. See [Customization](#customization). ### Search @@ -131,7 +135,7 @@ The [Search](/ui-kit/react/components/search) component needs a connection for k - A chat opens with its cached messages, then the server's page merges in. - A chat opened offline with nothing saved shows "Connect to load messages". It is read again once when the connection returns. - At an edge the cache can't fill (older history, or newer messages after jumping to a message), the list shows a "Connect to load more" row. The row is a button, and it also loads by itself once when the connection returns. -- Jumping to a message (from a search result, a quoted reply or the first unread message) works offline when that message is saved. If it isn't, the chat opens on its newest saved messages instead. +- Jumping to a message (from a search result, a quoted reply or the first unread message) works offline when that message is saved. If it isn't, a jump inside an open chat leaves the messages on screen as they are; only an error other than a lost connection calls `onError`. A chat that opens at a message that isn't saved opens on its newest saved messages instead. - After a long outage the catch-up may bring more than a page of new messages. While the user is reading older messages, a **Jump to latest** button appears instead of moving the list. @@ -142,11 +146,10 @@ The default message list asks the server for pages in the form the SDK caches, t - A message sent while offline appears in the list at once with a clock icon and the label "Not sent yet". It is sent automatically when the connection returns, and its receipt then updates as usual. - A message that fails shows an error mark and a **Not sent. Tap to retry** button under the bubble. The failed state survives a page reload. -- The message menu of an unsent or failed message offers only **Retry** and **Delete**. Actions that need a server copy (reply, edit, react and so on) are hidden until it is sent. **Delete** removes the message from this device. It is hidden when `hideDeleteMessageOption` is set. +- The message menu of an unsent or failed message offers only **Retry** and **Delete**. Actions that need a server copy (reply, edit, react and so on) are hidden until it is sent. **Delete** removes the message from this device. It is hidden when `hideDeleteMessageOption` is set. If the device no longer holds the message (for example after the user left the group), Retry and Delete remove it from the list. - Retry or Delete on a message whose send is already under way changes nothing and shows "Sending… try again in a moment". - If the outbox is full, the send is refused and the list shows "Too many messages waiting to send". A file larger than the media cache limit is refused with "File too large to send offline". See [Queue limits](/sdk/javascript/offline-send#queue-limits). -- In the [attachment staging tray](/ui-kit/react/components/message-composer#multi-attachment-staging-tray), a file whose upload stopped because the connection dropped is not treated as a bad file: pressing Send queues it with the rest of the message. -- Voice notes, stickers and the group call message queue like any other send. +- Stickers and the group call message are queued like any other send. ### Media @@ -158,13 +161,13 @@ These are not queued. They are sent as soon as the user acts, and they fail if t - **Reactions** show at once, then roll back and call the message list's `onError` if the request fails. - **Deleting** a sent message calls `onError` if it fails, and the message stays. -- **Editing** a message: the composer clears and leaves edit mode when the user sends the edit. If the edit fails, the message keeps its old text and `onError` is called. +- **Editing** a message: the composer clears and leaves edit mode when the user sends the edit. If the edit fails, the message keeps its old text and the message composer's `onError` is called. See [Edits, Deletes, and Reactions Need a Connection](/sdk/javascript/offline-send#edits-deletes-and-reactions-need-a-connection). ### Presence -While the SDK is disconnected, nobody shows as online: no online dot, no "Online" subtitle and no typing indicator, in any list or header, and screen readers are told the same. Presence comes back after the reconnect. +While the SDK is disconnected, nobody shows as online: there is no online dot in any list or header, and the header of a one-to-one chat shows no "Online" subtitle and no typing indicator. Screen readers are told the same. Presence comes back after the reconnect. ### Logout, user switch and cache reset @@ -174,7 +177,7 @@ If the SDK has to wipe and rebuild its cache (for example when the encryption ke ## Offline States and Texts -The texts are the same in every CometChat UI Kit. Override any of them with [custom translations](/ui-kit/react/localization#adding-custom-translations). +Override any of them with [custom translations](/ui-kit/react/localization#adding-custom-translations). | Text (en-US) | Where it appears | Localization key | | --- | --- | --- | @@ -197,6 +200,7 @@ The texts are the same in every CometChat UI Kit. Override any of them with [cus | Too many messages waiting to send | Message List notice | `message_list_queue_full` | | File too large to send offline | Message List notice | `message_list_file_too_large_offline` | | Sending… try again in a moment | Message List notice | `message_list_send_in_flight` | +| Couldn't remove the message | Error toast when **Delete** on an unsent message fails | `message_list_option_delete_failed` | | 1 unsent message was removed | Message List notice | `message_list_unsent_message_removed` | | `{{count}}` message(s) weren't sent | Message List notice | `message_list_messages_not_sent_one`, `message_list_messages_not_sent_other` | | `{{count}}` unsent message(s) couldn't be recovered | Conversations or Message List notice after a cache reset | `message_list_unsent_messages_lost_one`, `message_list_unsent_messages_lost_other` | @@ -208,9 +212,11 @@ Count texts have plural forms: the UI Kit picks `_one`, `_other` (and import { CometChatLocalize } from "@cometchat/chat-uikit-react"; const localize = CometChatLocalize.getSharedInstance(); -localize?.addTranslation("en-us", { - conversations_connect_to_load: "You're offline. Chats will load when you reconnect.", - message_list_not_sent_yet: "Waiting for network", +localize?.addTranslation({ + "en-us": { + conversations_connect_to_load: "You're offline. Chats will load when you reconnect.", + message_list_not_sent_yet: "Waiting for network", + }, }); ``` @@ -226,9 +232,9 @@ localize?.addTranslation("en-us", { `CometChatUIKit.sendTextMessage()`, `sendMediaMessage()` and `sendCustomMessage()` answer every send: -- Queueing a message does not reject the promise. It resolves when the message is sent and rejects on a final failure. -- A logout or user switch, a cache reset that loses the unsent messages, or the SDK removing the message rejects the promise once with an error whose `code` is `ERROR_OFFLINE_MESSAGE_DISCARDED`. -- The UI Kit shows nothing for that rejection: no error toast, no `onError`, and the composer does not lock. Only your own `.catch` hears of it. +- Queueing a message does not reject the promise. It resolves when the message is sent, and rejects once if the message fails or is removed before it is sent. A later **Retry** does not answer the same promise again. +- A logout or user switch, or a cache reset that lost (or may have lost) unsent messages, rejects the promise with an error whose `code` is `ERROR_OFFLINE_MESSAGE_DISCARDED`. A message removed later for another reason, for example the user's own **Delete**, rejects with its failure reason as the `code` (`DISCARDED`). +- The UI Kit shows nothing for an `ERROR_OFFLINE_MESSAGE_DISCARDED` rejection: no error toast, no `onError`, and the composer does not lock. Only your own `.catch` hears of it. ```tsx import { CometChat } from "@cometchat/chat-sdk-javascript"; @@ -313,7 +319,9 @@ The lists show your own `errorView` instead of "Connect to load …", and your o | `useCometChatNotificationFeedContext` | Yes | No | | `useCometChatPinnedMessagesContext` | Yes | No | | `useCometChatSavedMessagesContext` | Yes | No | -| `useCometChatSearchContext` | No | Yes | +| `useCometChatMessageListContext` (as `state.connectToLoad`) | Yes | No | + +The [Search](/ui-kit/react/components/search) component's context does not expose these flags. ### Style the offline UI From cbf1178ac1dd22d8ee095f183a28541b5cce41b6 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Thu, 19 Nov 2026 16:57:02 +0530 Subject: [PATCH 04/13] docs(ENG-57590): cover offline support across the React UI Kit pages Document setOfflineConfig() and logging out offline in Methods, the hideOfflineNotices prop on Conversations and Message List, the offline events in the event system, and the offline texts and keys in Localization. Add a short note with a link on the integration, overview, provider and affected component pages. Also fix the Methods note on the send methods (they publish ui:message/sent) and the addTranslation() example in Localization. Co-Authored-By: Claude Opus 5.5 Co-authored-by: multica-agent --- ui-kit/react/cometchat-provider.mdx | 2 + ui-kit/react/components/audio-bubble.mdx | 1 + ui-kit/react/components/conversations.mdx | 13 ++++ ui-kit/react/components/file-bubble.mdx | 1 + ui-kit/react/components/group-members.mdx | 1 + ui-kit/react/components/groups.mdx | 1 + ui-kit/react/components/image-bubble.mdx | 1 + ui-kit/react/components/message-composer.mdx | 1 + ui-kit/react/components/message-list.mdx | 15 ++++- ui-kit/react/components/notification-feed.mdx | 1 + ui-kit/react/components/pinned-messages.mdx | 1 + ui-kit/react/components/reaction-list.mdx | 1 + ui-kit/react/components/saved-messages.mdx | 1 + ui-kit/react/components/search.mdx | 1 + ui-kit/react/components/users.mdx | 1 + ui-kit/react/components/video-bubble.mdx | 1 + ui-kit/react/components/voice-note-bubble.mdx | 1 + ui-kit/react/event-system.mdx | 9 +++ ui-kit/react/integration-astro.mdx | 5 ++ ui-kit/react/integration-nextjs.mdx | 5 ++ ui-kit/react/integration-react-router.mdx | 5 ++ ui-kit/react/integration-react.mdx | 5 ++ ui-kit/react/localization.mdx | 43 ++++++++++++- ui-kit/react/methods.mdx | 60 +++++++++++++++---- ui-kit/react/overview.mdx | 1 + 25 files changed, 161 insertions(+), 16 deletions(-) diff --git a/ui-kit/react/cometchat-provider.mdx b/ui-kit/react/cometchat-provider.mdx index 669713707..fff1a668b 100644 --- a/ui-kit/react/cometchat-provider.mdx +++ b/ui-kit/react/cometchat-provider.mdx @@ -50,6 +50,8 @@ export default App; For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login(uid)`. +To turn on offline support (saved chats without a network, queued sends), add `.setOfflineConfig({ enabled: true })` to the builder before `build()`. See [Offline Support](/ui-kit/react/offline-support). + --- ## Props diff --git a/ui-kit/react/components/audio-bubble.mdx b/ui-kit/react/components/audio-bubble.mdx index 3d7afd903..38e7c7d29 100644 --- a/ui-kit/react/components/audio-bubble.mdx +++ b/ui-kit/react/components/audio-bubble.mdx @@ -39,6 +39,7 @@ Key capabilities: - **Download button** — download individual audio files - **Batch grouping** — rendered as one connected group when several media messages are sent together (handled by the [message list](/ui-kit/react/components/message-list#multi-attachment-batch-grouping)) - **Caption support** — optional caption rendered below the cards +- **Offline support** — with [offline support](/ui-kit/react/offline-support) on, media downloaded while online is shown from the device; a file that isn't saved shows "Available when online" while offline, and tapping it asks the SDK to download it **Live Preview** — interact with the audio bubble. diff --git a/ui-kit/react/components/conversations.mdx b/ui-kit/react/components/conversations.mdx index e997cd480..16e94cb09 100644 --- a/ui-kit/react/components/conversations.mdx +++ b/ui-kit/react/components/conversations.mdx @@ -53,6 +53,7 @@ description: "Scrollable list of recent one-on-one and group conversations for t "hideUnreadCount": { "type": "boolean", "default": false }, "hideDeleteConversation": { "type": "boolean", "default": false }, "hidePinConversation": { "type": "boolean", "default": false }, + "hideOfflineNotices": { "type": "boolean", "default": false, "since": "7.3.0", "note": "Offline support only." }, "showSearchBar": { "type": "boolean", "default": true }, "showScrollbar": { "type": "boolean", "default": false } }, @@ -165,6 +166,7 @@ The component handles: - Search filtering - Selection mode (single/multiple) - Pin conversation — pin a chat to the top of the list, with a pin indicator on the row +- Offline support (when turned on) — saved conversations first, "Connect to load chats" when nothing is saved, and a notice if unsent messages were lost. See [Offline Support](/ui-kit/react/offline-support) --- @@ -1090,6 +1092,17 @@ Remove the built-in **Pin / Unpin** option from the conversation item's context --- +### hideOfflineNotices + +Hide the notice that [offline support](/ui-kit/react/offline-support#hide-the-offline-notices) shows after a cache reset lost, or may have lost, unsent messages. Has no effect with offline support off. + +| | | +| --- | --- | +| Type | `boolean` | +| Default | `false` | + +--- + ### showSearchBar Whether to show the search bar. Set to `false` to hide it entirely. diff --git a/ui-kit/react/components/file-bubble.mdx b/ui-kit/react/components/file-bubble.mdx index d7dd901b2..0ffc1f976 100644 --- a/ui-kit/react/components/file-bubble.mdx +++ b/ui-kit/react/components/file-bubble.mdx @@ -32,6 +32,7 @@ Key capabilities: - **Download button** — download individual files - **Batch grouping** — rendered as one connected group when several media messages are sent together (handled by the [message list](/ui-kit/react/components/message-list#multi-attachment-batch-grouping)) - **Caption support** — optional caption rendered below the cards +- **Offline support** — with [offline support](/ui-kit/react/offline-support) on, media downloaded while online is shown from the device; a file that isn't saved shows "Available when online" while offline, and tapping it asks the SDK to download it **Live Preview** — interact with the file bubble. diff --git a/ui-kit/react/components/group-members.mdx b/ui-kit/react/components/group-members.mdx index f69f0b1f5..256b6b90a 100644 --- a/ui-kit/react/components/group-members.mdx +++ b/ui-kit/react/components/group-members.mdx @@ -44,6 +44,7 @@ The component handles: - Search filtering - Role-based action menus (kick, ban, change scope) - Selection mode (single/multiple) +- Offline support (when turned on) — saved members first, and "Connect to load members" or "Connect to search" when nothing is saved. See [Offline Support](/ui-kit/react/offline-support) --- diff --git a/ui-kit/react/components/groups.mdx b/ui-kit/react/components/groups.mdx index 0a3b8ae83..4df459408 100644 --- a/ui-kit/react/components/groups.mdx +++ b/ui-kit/react/components/groups.mdx @@ -45,6 +45,7 @@ The component handles: - Search filtering - Swipe/hover options - Selection mode (single/multiple) +- Offline support (when turned on) — saved groups first, and "Connect to load groups" or "Connect to search" when nothing is saved. See [Offline Support](/ui-kit/react/offline-support) --- diff --git a/ui-kit/react/components/image-bubble.mdx b/ui-kit/react/components/image-bubble.mdx index edc864c52..9014d9fb5 100644 --- a/ui-kit/react/components/image-bubble.mdx +++ b/ui-kit/react/components/image-bubble.mdx @@ -30,6 +30,7 @@ Key capabilities: - **Fullscreen gallery viewer** — click any image to open a paginated fullscreen gallery - **Batch grouping** — rendered as one connected group when several media messages are sent together (handled by the [message list](/ui-kit/react/components/message-list#multi-attachment-batch-grouping)) - **Placeholder loading** — shows a configurable placeholder while images load +- **Offline support** — with [offline support](/ui-kit/react/offline-support) on, media downloaded while online is shown from the device; a file that isn't saved shows "Available when online" while offline, and tapping it asks the SDK to download it **Live Preview** — interact with the image bubble. diff --git a/ui-kit/react/components/message-composer.mdx b/ui-kit/react/components/message-composer.mdx index 892cb3317..18e80a028 100644 --- a/ui-kit/react/components/message-composer.mdx +++ b/ui-kit/react/components/message-composer.mdx @@ -162,6 +162,7 @@ The component handles: - Edit and reply mode with preview banners - Typing indicator events - Live reactions +- Offline support (when turned on) — a text message or sticker sent without a connection is queued and goes out on reconnect. See [Offline Support](/ui-kit/react/offline-support) --- diff --git a/ui-kit/react/components/message-list.mdx b/ui-kit/react/components/message-list.mdx index 1ceafd426..2b138dff5 100644 --- a/ui-kit/react/components/message-list.mdx +++ b/ui-kit/react/components/message-list.mdx @@ -82,7 +82,8 @@ description: "Scrollable message feed with plugin-based bubble rendering, reacti "showConversationStarters": { "type": "boolean", "default": false }, "showMarkAsUnreadOption": { "type": "boolean", "default": false }, "disableTruncation": { "type": "boolean", "default": false }, - "isAgentChat": { "type": "boolean", "default": false } + "isAgentChat": { "type": "boolean", "default": false }, + "hideOfflineNotices": { "type": "boolean", "default": false, "since": "7.3.0", "note": "Offline support only." } }, "optionToggles": { "hideReplyOption": { "type": "boolean", "default": false }, @@ -250,6 +251,7 @@ The component handles: - Date separators and sticky floating date header - Jump-to-message for search results and deep links - Mark-as-unread support +- Offline support (when turned on) — cached messages first, unsent messages marked with Retry and Delete, and "Connect to load …" where the cache runs out. See [Offline Support](/ui-kit/react/offline-support) > **Note:** `user` and `group` are mutually exclusive. Pass one or the other to specify the conversation context. @@ -1015,6 +1017,17 @@ Whether this is an AI agent chat. Suppresses moderation UI and enables agent-spe --- +### hideOfflineNotices + +Hide the notices about unsent messages that [offline support](/ui-kit/react/offline-support#hide-the-offline-notices) shows in the list (removed, not sent, lost in a cache reset, outbox full, file too large, send under way). Has no effect with offline support off. + +| | | +| --- | --- | +| Type | `boolean` | +| Default | `false` | + +--- + ### Option Toggles --- diff --git a/ui-kit/react/components/notification-feed.mdx b/ui-kit/react/components/notification-feed.mdx index fe47845ef..7cbdb9e55 100644 --- a/ui-kit/react/components/notification-feed.mdx +++ b/ui-kit/react/components/notification-feed.mdx @@ -207,6 +207,7 @@ The component handles these automatically — no manual setup needed: | Timestamp grouping | Groups items as "Today", "Yesterday", day name, or date | | Category filtering | Filter chips row with per-category unread badges | | Mark all read | Header button to mark all notifications as read | +| Offline support | With [offline support](/ui-kit/react/offline-support) on, saved items show first; with nothing saved offline, the feed shows "Connect to load notifications" and loads again on reconnect | --- diff --git a/ui-kit/react/components/pinned-messages.mdx b/ui-kit/react/components/pinned-messages.mdx index 75dbb3fb4..739aec846 100644 --- a/ui-kit/react/components/pinned-messages.mdx +++ b/ui-kit/react/components/pinned-messages.mdx @@ -122,6 +122,7 @@ The component handles: - Real-time updates when a message is pinned or unpinned - An overflow menu of per-message options (unpin, save, copy, info, and more) - Empty, loading, and error states +- Offline support (when turned on) — saved pinned messages first, and "Connect to load messages" when nothing is saved. See [Offline Support](/ui-kit/react/offline-support) Pinning must be enabled for your app through the `features.ux.messages.pinned.enabled` app setting for pins to load. See [Core Features](/ui-kit/react/core-features#pin-and-save-messages). diff --git a/ui-kit/react/components/reaction-list.mdx b/ui-kit/react/components/reaction-list.mdx index 60b543f59..c86e7a97a 100644 --- a/ui-kit/react/components/reaction-list.mdx +++ b/ui-kit/react/components/reaction-list.mdx @@ -161,6 +161,7 @@ Called when an error occurs during reaction fetching. - "All" tab shows every reactor across all emojis. - Per-emoji tabs show only reactors for that emoji. - Tab counts update optimistically when the current user removes a reaction. +- With [offline support](/ui-kit/react/offline-support) on and no reactors saved, the list shows "Connect to load reactions", and the tabs show the message's own reaction counts until the list can load. - Keyboard navigation: `ArrowLeft` / `ArrowRight` to move between tabs, `Enter` / `Space` to select. ### Reactor Items diff --git a/ui-kit/react/components/saved-messages.mdx b/ui-kit/react/components/saved-messages.mdx index da3115991..6f42d0b25 100644 --- a/ui-kit/react/components/saved-messages.mdx +++ b/ui-kit/react/components/saved-messages.mdx @@ -99,6 +99,7 @@ The component handles: - Real-time updates when a message is saved or unsaved - An unsave action per row - Empty, loading, and error states +- Offline support (when turned on) — saved messages from the cache first, and "Connect to load messages" when nothing is saved. See [Offline Support](/ui-kit/react/offline-support) Saving must be enabled for your app through the `features.ux.messages.saved.enabled` app setting for saves to load. See [Core Features](/ui-kit/react/core-features#pin-and-save-messages). diff --git a/ui-kit/react/components/search.mdx b/ui-kit/react/components/search.mdx index 2d1a2f27e..f2ce943d2 100644 --- a/ui-kit/react/components/search.mdx +++ b/ui-kit/react/components/search.mdx @@ -49,6 +49,7 @@ The component handles: - Scoped search via `uid` or `guid` - Custom request builders for both conversations and messages - Customizable result item views +- Offline support (when turned on) — a keyword search offline with nothing saved shows "Connect to search"; a search by filter alone is answered from the device. See [Offline Support](/ui-kit/react/offline-support) --- diff --git a/ui-kit/react/components/users.mdx b/ui-kit/react/components/users.mdx index 83d5dae6d..10b1a24c3 100644 --- a/ui-kit/react/components/users.mdx +++ b/ui-kit/react/components/users.mdx @@ -45,6 +45,7 @@ The component handles: - Search filtering - Alphabetical section headers - Selection mode (single/multiple) with optional preview chips +- Offline support (when turned on) — saved users first, and "Connect to load users" or "Connect to search" when nothing is saved. See [Offline Support](/ui-kit/react/offline-support) --- diff --git a/ui-kit/react/components/video-bubble.mdx b/ui-kit/react/components/video-bubble.mdx index 90bf286dd..97e69c165 100644 --- a/ui-kit/react/components/video-bubble.mdx +++ b/ui-kit/react/components/video-bubble.mdx @@ -32,6 +32,7 @@ Key capabilities: - **Play icon overlay** — visual indicator on each video tile - **Fullscreen viewer** — click any video to open in fullscreen player - **Batch grouping** — rendered as one connected group when several media messages are sent together (handled by the [message list](/ui-kit/react/components/message-list#multi-attachment-batch-grouping)) +- **Offline support** — with [offline support](/ui-kit/react/offline-support) on, media downloaded while online is shown from the device; a file that isn't saved shows "Available when online" while offline, and tapping it asks the SDK to download it Auto poster thumbnails are produced by the **Thumbnail Generation** extension — enable it in the Dashboard ([Thumbnail Generation](/fundamentals/thumbnail-generation)). Without it, the bubble falls back to the first video frame. diff --git a/ui-kit/react/components/voice-note-bubble.mdx b/ui-kit/react/components/voice-note-bubble.mdx index 29843de14..215befe6c 100644 --- a/ui-kit/react/components/voice-note-bubble.mdx +++ b/ui-kit/react/components/voice-note-bubble.mdx @@ -44,6 +44,7 @@ Key characteristics: - **Always standalone** — voice notes are never grouped or batched with other messages - **Metadata-driven** — only used when the message has `audioType: "voice_note"` in metadata - **Waveform player** — renders with the `CometChatAudioBubble` player and its CSS selectors +- **Offline support** — with [offline support](/ui-kit/react/offline-support) on, a voice note downloaded while online plays from the device; one that isn't saved shows "Available when online" while offline, and tapping it asks the SDK to download it **Live Preview** — interact with the voice note bubble. diff --git a/ui-kit/react/event-system.mdx b/ui-kit/react/event-system.mdx index 398782105..bb3d6ed4a 100644 --- a/ui-kit/react/event-system.mdx +++ b/ui-kit/react/event-system.mdx @@ -259,6 +259,15 @@ v6's `ccMessageSent` fired at the same three stages, so the staging itself is no Change either to `status === "success"`, or import `CometChatMessageStatus` and compare with `CometChatMessageStatus.success`. +### Offline Support + +Published only with [offline support](/ui-kit/react/offline-support#events) turned on. + +| Event Type | Payload | Published by | +| --- | --- | --- | +| `ui:message/send-state-changed` | `{ message, state, reason? }` | UI Kit, when an own message's send state changes (`"sending"`, `"sent"`, `"failed"`, `"discarded"`) | +| `ui:offline/cache-reset` | `{ reason, pendingMessagesLost }` | UI Kit, when the SDK wiped and rebuilt its offline cache | + ### Pin and Save (optimistic) Published by the message options the moment a pin/save succeeds locally, before the network echo. Pinned/Saved panels and the message list listen to these so every surface flips together. diff --git a/ui-kit/react/integration-astro.mdx b/ui-kit/react/integration-astro.mdx index 6163d3a48..621c13f4b 100644 --- a/ui-kit/react/integration-astro.mdx +++ b/ui-kit/react/integration-astro.mdx @@ -17,6 +17,7 @@ description: "Add CometChat to an Astro app in 5 steps: create project, install, | Auth Key | Dev/testing only. Use Auth Token in production | | SSR | Use `client:only="react"` directive — CometChat components cannot be server-rendered | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) · [Next.js](/ui-kit/react/integration-nextjs) · [React Router](/ui-kit/react/integration-react-router) | @@ -162,6 +163,10 @@ export default function CometChatApp() { For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login(uid)`. Generate auth tokens server-side via the CometChat REST API. Never ship auth keys in client code. + +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). + + --- ## Step 4 — Render the Island in an Astro Page diff --git a/ui-kit/react/integration-nextjs.mdx b/ui-kit/react/integration-nextjs.mdx index 3f4866176..7fc81d072 100644 --- a/ui-kit/react/integration-nextjs.mdx +++ b/ui-kit/react/integration-nextjs.mdx @@ -17,6 +17,7 @@ description: "Add CometChat to a Next.js (App Router) app in 5 steps: create pro | Auth Key | Dev/testing only. Use `loginWithAuthToken` in production | | SSR | CometChat components must be loaded with `dynamic(() => import(...), { ssr: false })` | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) · [React Router](/ui-kit/react/integration-react-router) · [Astro](/ui-kit/react/integration-astro) | @@ -162,6 +163,10 @@ export default function CometChatClient() { For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login(uid)`. Generate auth tokens server-side via the CometChat REST API. Never ship auth keys in client code. + +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). + + --- ## Step 4 — Import with SSR Disabled diff --git a/ui-kit/react/integration-react-router.mdx b/ui-kit/react/integration-react-router.mdx index 0dfa7d272..e957d2ec5 100644 --- a/ui-kit/react/integration-react-router.mdx +++ b/ui-kit/react/integration-react-router.mdx @@ -17,6 +17,7 @@ description: "Add CometChat to a React Router app in 5 steps: create project, in | Auth Key | Dev/testing only. Use Auth Token in production | | SSR | N/A — client-side SPA by default | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) · [Next.js](/ui-kit/react/integration-nextjs) · [Astro](/ui-kit/react/integration-astro) | @@ -180,6 +181,10 @@ Init and login complete before the app renders. `CometChatProvider` then supplie For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login(uid)`. Generate auth tokens server-side via the CometChat REST API. Never ship auth keys in client code. + +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). + + --- ## Step 4 — Run diff --git a/ui-kit/react/integration-react.mdx b/ui-kit/react/integration-react.mdx index 6fcdb00f2..b35489136 100644 --- a/ui-kit/react/integration-react.mdx +++ b/ui-kit/react/integration-react.mdx @@ -16,6 +16,7 @@ description: "Add CometChat to a React.js app in 4 steps: create project, instal | Order | `init()` → `login()` → render ``. Breaking this order = blank screen | | Auth Key | Dev/testing only. Use Auth Token in production | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [Next.js](/ui-kit/react/integration-nextjs) · [React Router](/ui-kit/react/integration-react-router) · [Astro](/ui-kit/react/integration-astro) | @@ -174,6 +175,10 @@ export default App; For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login(uid)`. Generate auth tokens server-side via the [REST API](/rest-api/chat-apis). Never ship auth keys in client code. + +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). + + By default, session data is stored in `localStorage`. To use `sessionStorage` instead, see [Setting Session Storage Mode](/ui-kit/react/methods#setting-session-storage-mode). diff --git a/ui-kit/react/localization.mdx b/ui-kit/react/localization.mdx index e7b179d0c..a63a45395 100644 --- a/ui-kit/react/localization.mdx +++ b/ui-kit/react/localization.mdx @@ -84,12 +84,49 @@ Override or add translation keys for a language: import { CometChatLocalize } from "@cometchat/chat-uikit-react"; const localize = CometChatLocalize.getSharedInstance(); -localize?.addTranslation("en-us", { - "custom_greeting": "Welcome to our chat!", - "message_deleted": "Message removed", // Override built-in key +localize?.addTranslation({ + "en-us": { + "custom_greeting": "Welcome to our chat!", + "message_deleted": "Message removed", // Override built-in key + }, }); ``` +`addTranslation()` takes one object keyed by language code, so you can add several languages in one call. + +### Offline Support Texts + +With [offline support](/ui-kit/react/offline-support) turned on, the UI Kit shows these texts. Every built-in language has them, and you override them like any other key. For where each one appears, see [Offline States and Texts](/ui-kit/react/offline-support#offline-states-and-texts). + +| Key | en-us | +| --- | --- | +| `conversations_connect_to_load` | Connect to load chats | +| `users_connect_to_load` | Connect to load users | +| `groups_connect_to_load` | Connect to load groups | +| `group_members_connect_to_load` | Connect to load members | +| `message_list_connect_to_load` | Connect to load messages | +| `reaction_list_connect_to_load` | Connect to load reactions | +| `notifications_connect_to_load` | Connect to load notifications | +| `search_connect_to_search` | Connect to search | +| `search_connect_to_search_messages` | Connect to search | +| `search_connect_to_search_subtitle` | Search needs an internet connection. | +| `message_list_connect_to_load_more` | Connect to load more | +| `message_list_connect_to_load_newer` | Connect to load more | +| `message_list_jump_to_latest` | Jump to latest | +| `message_list_not_sent_yet` | Not sent yet | +| `message_list_not_sent_tap_to_retry` | Not sent. Tap to retry | +| `message_bubble_media_available_when_online` | Available when online | +| `message_list_queue_full` | Too many messages waiting to send | +| `message_list_file_too_large_offline` | File too large to send offline | +| `message_list_send_in_flight` | Sending… try again in a moment | +| `message_list_option_delete_failed` | Couldn't remove the message | +| `message_list_unsent_message_removed` | 1 unsent message was removed | +| `message_list_messages_not_sent_one` / `_other` | `{{count}}` message wasn't sent / `{{count}}` messages weren't sent | +| `message_list_unsent_messages_lost_one` / `_other` | `{{count}}` unsent message couldn't be recovered / `{{count}}` unsent messages couldn't be recovered | +| `message_list_unsent_messages_maybe_lost` | Some unsent messages may not have been sent | + +The count texts are plural keys: the UI Kit picks `_one`, `_other`, and `_few` or `_many` where a language has them, for the current language, and replaces `{{count}}` with the number. Override every plural form your language uses. + --- ## Fallback Language diff --git a/ui-kit/react/methods.mdx b/ui-kit/react/methods.mdx index 4a930787c..277e2a356 100644 --- a/ui-kit/react/methods.mdx +++ b/ui-kit/react/methods.mdx @@ -91,6 +91,26 @@ When using `sessionStorage`, configure it in your `UIKitSettingsBuilder` before Session storage is cleared when the browser tab is closed. Use this mode if you want users to re-authenticate on every new tab/session. +### Enabling Offline Support + +Offline support is off by default. To show saved chats and messages without a network and queue messages sent while offline, call `setOfflineConfig()` on the `UIKitSettingsBuilder` with `enabled: true`. It needs `@cometchat/chat-uikit-react` 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later; on an older SDK the setting has no effect. + +```tsx +import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react"; + +const settings = new UIKitSettingsBuilder() + .setAppId("APP_ID") + .setRegion("REGION") + .setAuthKey("AUTH_KEY") + .subscribePresenceForAllUsers() + .setOfflineConfig({ enabled: true }) + .build(); + +await CometChatUIKit.init(settings); +``` + +The config is passed to the SDK's `AppSettingsBuilder.setOfflineConfig()` unchanged; its type is `CometChatOfflineConfig`. `CometChatUIKit.getSettings()?.getOfflineConfig()` returns what you passed, not whether offline support is running; call `CometChat.isOfflineEnabled()` for that. See [Offline Support](/ui-kit/react/offline-support) for the options, the offline states and how each component behaves. + --- ## Authentication @@ -133,6 +153,30 @@ await CometChatUIKit.logout(); **Returns:** `Promise` +With [offline support](/ui-kit/react/offline-support) on, logging out also deletes the user's cached data and unsent messages from the device. + +#### Logging out without a connection + +When the server can't be reached, `logout()` still ends the session on the device, then rejects. A rejection alone doesn't mean the user is still logged in, so check the SDK before deciding where to go: + +```tsx +import { CometChat } from "@cometchat/chat-sdk-javascript"; +import { CometChatUIKit } from "@cometchat/chat-uikit-react"; + +async function signOut(showSignIn: () => void) { + try { + await CometChatUIKit.logout(); + } catch (error) { + const user = await CometChat.getLoggedinUser().catch(() => null); + if (user) { + console.error("Logout failed", error); + return; + } + } + showSignIn(); +} +``` + --- ## User Management @@ -227,19 +271,11 @@ Get conversation update settings fetched from the dashboard. ## Message Sending - -These methods are low-level utilities. They send messages via the SDK but do **not** publish `ui:message/sent` events. This means: -- The message won't appear in `CometChatMessageList` automatically -- The `CometChatConversations` list won't update - -For messages to appear in the UI, use the `CometChatMessageComposer` component, or manually publish the event after sending: + +While a `CometChatProvider` is mounted, these methods publish `ui:message/sent` (in progress, then success or error), so a mounted `CometChatMessageList` and `CometChatConversations` show the message without any extra code. Don't publish `ui:message/sent` again yourself for the same send. + -```tsx -const publish = usePublishEvent(); -const msg = await CometChatUIKit.sendTextMessage(message); -publish({ type: "ui:message/sent", message: msg, status: CometChatMessageStatus.success }); -``` - +With [offline support](/ui-kit/react/offline-support) on, the returned Promise resolves when the message is actually sent. A message the SDK queues while offline does not reject it. A logout, a user switch or a cache reset that loses unsent messages before it is sent rejects the Promise with the code `ERROR_OFFLINE_MESSAGE_DISCARDED`. See [Send promises](/ui-kit/react/offline-support#send-promises). ### `CometChatUIKit.sendTextMessage(message)` diff --git a/ui-kit/react/overview.mdx b/ui-kit/react/overview.mdx index 0e05a1456..7b23d71f5 100644 --- a/ui-kit/react/overview.mdx +++ b/ui-kit/react/overview.mdx @@ -67,6 +67,7 @@ Pick your framework and follow the step-by-step integration guide: - **Theming** — CSS custom properties (`--cometchat-*`) with built-in light and dark themes - **Localization** — 19 supported languages with customizable translation keys - **Calling** — optional voice and video calling via `@cometchat/calls-sdk-javascript` +- **Offline support** — optional, off by default: saved chats and messages without a network, and queued sends. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) - **SSR-safe** — no browser-only APIs at module scope; Next.js App Router compatible - **Tree-shakeable** — ESM-first build with dual ESM + CJS output From 9bcf990e56077ed108e2fbbe2220cc3f5de7a151 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Thu, 19 Nov 2026 17:28:26 +0530 Subject: [PATCH 05/13] docs(ENG-57590): tighten offline wording on send promises, Retry/Delete and presence List the CometChatUIKit send methods as publishers of ui:message/sent, say a cache reset rejects a send only when unsent messages were or may have been lost, describe Retry and Delete on a message that was already sent, and note that the typing indicator is hidden in group chat headers too. Co-Authored-By: Claude Opus 5.5 Co-authored-by: multica-agent --- ui-kit/react/event-system.mdx | 2 +- ui-kit/react/offline-support.mdx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-kit/react/event-system.mdx b/ui-kit/react/event-system.mdx index bb3d6ed4a..13e1e8755 100644 --- a/ui-kit/react/event-system.mdx +++ b/ui-kit/react/event-system.mdx @@ -226,7 +226,7 @@ These events are published by UI Kit components for local cross-component commun | Event Type | Payload | Published by | | --- | --- | --- | -| `ui:message/sent` | `{ message, status }` | MessageComposer | +| `ui:message/sent` | `{ message, status }` | MessageComposer; `CometChatUIKit.sendTextMessage()` / `sendMediaMessage()` / `sendCustomMessage()` | | `ui:message/deleted` | `{ message }` | MessageList (after delete) | | `ui:message/read` | `{ message }` | MessageList (mark as read) | diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 1832432d7..491a260b3 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -15,7 +15,7 @@ description: "Show saved chats and messages without a network, queue sends until | Runtime check | `CometChat.isOfflineEnabled()` from `@cometchat/chat-sdk-javascript` | | Props | `hideOfflineNotices` on `CometChatMessageList` and `CometChatConversations` (default `false`) | | Events | `ui:message/send-state-changed`, `ui:offline/cache-reset` via `useCometChatEvents` | -| Send promise | `CometChatUIKit.sendTextMessage` / `sendMediaMessage` / `sendCustomMessage` resolve when sent; a logout, user switch or cache reset rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` | +| Send promise | `CometChatUIKit.sendTextMessage` / `sendMediaMessage` / `sendCustomMessage` resolve when sent; a logout, user switch, or cache reset that lost (or may have lost) unsent messages rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` | | Styling | `--cometchat-message-bubble-offline-*`, `--cometchat-message-list-offline-*`, `--cometchat-conversations-offline-*`, `--cometchat-offline-media-unavailable-*` CSS variables | @@ -146,7 +146,7 @@ The default message list asks the server for pages in the form the SDK caches, t - A message sent while offline appears in the list at once with a clock icon and the label "Not sent yet". It is sent automatically when the connection returns, and its receipt then updates as usual. - A message that fails shows an error mark and a **Not sent. Tap to retry** button under the bubble. The failed state survives a page reload. -- The message menu of an unsent or failed message offers only **Retry** and **Delete**. Actions that need a server copy (reply, edit, react and so on) are hidden until it is sent. **Delete** removes the message from this device. It is hidden when `hideDeleteMessageOption` is set. If the device no longer holds the message (for example after the user left the group), Retry and Delete remove it from the list. +- The message menu of an unsent or failed message offers only **Retry** and **Delete**. Actions that need a server copy (reply, edit, react and so on) are hidden until it is sent. **Delete** removes the message from this device. It is hidden when `hideDeleteMessageOption` is set. If the device no longer holds the message (for example after the user left the group), Retry and Delete remove it from the list. If it was in fact already sent, Retry leaves the row as it is, and Delete deletes the sent message as usual, which needs a connection. - Retry or Delete on a message whose send is already under way changes nothing and shows "Sending… try again in a moment". - If the outbox is full, the send is refused and the list shows "Too many messages waiting to send". A file larger than the media cache limit is refused with "File too large to send offline". See [Queue limits](/sdk/javascript/offline-send#queue-limits). - Stickers and the group call message are queued like any other send. @@ -167,7 +167,7 @@ See [Edits, Deletes, and Reactions Need a Connection](/sdk/javascript/offline-se ### Presence -While the SDK is disconnected, nobody shows as online: there is no online dot in any list or header, and the header of a one-to-one chat shows no "Online" subtitle and no typing indicator. Screen readers are told the same. Presence comes back after the reconnect. +While the SDK is disconnected, nobody shows as online: there is no online dot in any list or header, the header of a one-to-one chat shows no "Online" subtitle, and the header of a one-to-one or group chat shows no typing indicator. Screen readers are told the same. Presence comes back after the reconnect. ### Logout, user switch and cache reset From d177246c627396f2ec45e08b4a0698600b49c8ee Mon Sep 17 00:00:00 2001 From: rajdubey Date: Thu, 19 Nov 2026 20:22:29 +0530 Subject: [PATCH 06/13] docs(ENG-57590): stop implying files are queued offline and align offline caveats Co-Authored-By: Claude Opus 5.5 Co-authored-by: multica-agent --- ui-kit/react/components/message-header.mdx | 1 + ui-kit/react/components/message-list.mdx | 2 +- ui-kit/react/methods.mdx | 2 +- ui-kit/react/offline-support.mdx | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ui-kit/react/components/message-header.mdx b/ui-kit/react/components/message-header.mdx index 97b85d112..dc657c1e4 100644 --- a/ui-kit/react/components/message-header.mdx +++ b/ui-kit/react/components/message-header.mdx @@ -183,6 +183,7 @@ The component handles: - Online/offline presence status (for 1-on-1 conversations) - Group member count (for group conversations) - Real-time typing indicators +- Offline support (when turned on) — while the SDK is disconnected, the one-to-one header shows no "Online" subtitle and no header shows typing; a group header keeps its member count. See [Offline Support](/ui-kit/react/offline-support) - Voice and video call buttons with call state management - Back navigation for mobile layouts - AI conversation summary trigger diff --git a/ui-kit/react/components/message-list.mdx b/ui-kit/react/components/message-list.mdx index 2b138dff5..f1f05ee0b 100644 --- a/ui-kit/react/components/message-list.mdx +++ b/ui-kit/react/components/message-list.mdx @@ -1019,7 +1019,7 @@ Whether this is an AI agent chat. Suppresses moderation UI and enables agent-spe ### hideOfflineNotices -Hide the notices about unsent messages that [offline support](/ui-kit/react/offline-support#hide-the-offline-notices) shows in the list (removed, not sent, lost in a cache reset, outbox full, file too large, send under way). Has no effect with offline support off. +Hide the notices about unsent messages that [offline support](/ui-kit/react/offline-support#hide-the-offline-notices) shows in the list (removed, not sent, lost in a cache reset, outbox full, send refused, send under way). Has no effect with offline support off. | | | | --- | --- | diff --git a/ui-kit/react/methods.mdx b/ui-kit/react/methods.mdx index 277e2a356..e64843015 100644 --- a/ui-kit/react/methods.mdx +++ b/ui-kit/react/methods.mdx @@ -275,7 +275,7 @@ Get conversation update settings fetched from the dashboard. While a `CometChatProvider` is mounted, these methods publish `ui:message/sent` (in progress, then success or error), so a mounted `CometChatMessageList` and `CometChatConversations` show the message without any extra code. Don't publish `ui:message/sent` again yourself for the same send. -With [offline support](/ui-kit/react/offline-support) on, the returned Promise resolves when the message is actually sent. A message the SDK queues while offline does not reject it. A logout, a user switch or a cache reset that loses unsent messages before it is sent rejects the Promise with the code `ERROR_OFFLINE_MESSAGE_DISCARDED`. See [Send promises](/ui-kit/react/offline-support#send-promises). +With [offline support](/ui-kit/react/offline-support) on, the returned Promise resolves when the message is actually sent. A message the SDK queues while offline does not reject it. A logout, a user switch or a cache reset that lost (or may have lost) unsent messages before it is sent rejects the Promise with the code `ERROR_OFFLINE_MESSAGE_DISCARDED`. See [Send promises](/ui-kit/react/offline-support#send-promises). ### `CometChatUIKit.sendTextMessage(message)` diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 491a260b3..13f5c978c 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -39,6 +39,7 @@ The UI Kit builds on [offline support in the JavaScript SDK](/sdk/javascript/off - Keyword search with no saved match, and keyword search in the Search component. - Edits, deletes, reactions and other actions on messages that are already sent. They are not queued. (Retry and Delete on a message that is not sent yet work offline.) - Calls, call logs, message information and AI features such as streamed replies. +- Attachments (images, video, audio, files and voice notes) picked while offline are not guaranteed to send, so don't rely on them being queued. Send them when connected. ## Requirements @@ -148,7 +149,7 @@ The default message list asks the server for pages in the form the SDK caches, t - A message that fails shows an error mark and a **Not sent. Tap to retry** button under the bubble. The failed state survives a page reload. - The message menu of an unsent or failed message offers only **Retry** and **Delete**. Actions that need a server copy (reply, edit, react and so on) are hidden until it is sent. **Delete** removes the message from this device. It is hidden when `hideDeleteMessageOption` is set. If the device no longer holds the message (for example after the user left the group), Retry and Delete remove it from the list. If it was in fact already sent, Retry leaves the row as it is, and Delete deletes the sent message as usual, which needs a connection. - Retry or Delete on a message whose send is already under way changes nothing and shows "Sending… try again in a moment". -- If the outbox is full, the send is refused and the list shows "Too many messages waiting to send". A file larger than the media cache limit is refused with "File too large to send offline". See [Queue limits](/sdk/javascript/offline-send#queue-limits). +- If the outbox is full, the send is refused and the list shows "Too many messages waiting to send". Some sends are refused while offline with "File too large to send offline". See [Queue limits](/sdk/javascript/offline-send#queue-limits). - Stickers and the group call message are queued like any other send. ### Media @@ -198,7 +199,7 @@ Override any of them with [custom translations](/ui-kit/react/localization#addin | Not sent. Tap to retry | Button and label on a failed message | `message_list_not_sent_tap_to_retry` | | Available when online | Media bubble whose file is not saved | `message_bubble_media_available_when_online` | | Too many messages waiting to send | Message List notice | `message_list_queue_full` | -| File too large to send offline | Message List notice | `message_list_file_too_large_offline` | +| File too large to send offline | Message List notice when a send is refused | `message_list_file_too_large_offline` | | Sending… try again in a moment | Message List notice | `message_list_send_in_flight` | | Couldn't remove the message | Error toast when **Delete** on an unsent message fails | `message_list_option_delete_failed` | | 1 unsent message was removed | Message List notice | `message_list_unsent_message_removed` | @@ -297,7 +298,7 @@ These events are new members of the exported `CometChatEvent` union. If your Typ | Component | Prop | Default | Hides | | --- | --- | --- | --- | -| [Message List](/ui-kit/react/components/message-list) | `hideOfflineNotices` | `false` | The notices about unsent messages: removed, not sent, lost in a cache reset, outbox full, file too large, send under way | +| [Message List](/ui-kit/react/components/message-list) | `hideOfflineNotices` | `false` | The notices about unsent messages: removed, not sent, lost in a cache reset, outbox full, send refused, send under way | | [Conversations](/ui-kit/react/components/conversations) | `hideOfflineNotices` | `false` | The notice shown after a cache reset lost, or may have lost, unsent messages | ```tsx From 0d81b7bc20c90d146fa90bb6bcc317d48e25b094 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Mon, 23 Nov 2026 17:26:03 +0530 Subject: [PATCH 07/13] docs(ENG-57590): bump React UI Kit to 7.3.0 and JS Chat SDK to 4.3.1 The offline release ships the React UI Kit as a minor bump from the live 7.2.6 (-> 7.3.0) and the JavaScript Chat SDK as a patch from the live 4.3.0 (-> 4.3.1), so the docs that name those versions move with it. sdk/javascript: every offline minimum-version statement moves 4.3.0 -> 4.3.1, including the pinned install in offline-enable.mdx. offline-sync and offline-media-caching had no minimum-version line at all; both now carry one. Install instructions in setup-sdk.mdx are unpinned and are left alone. ui-kit/react: the Chat SDK offline minimum moves 4.3.0 -> 4.3.1 across offline-support, the four integration pages, overview, methods and core-features. The "latest" UI Kit references in overview.mdx and migration-overview.mdx move 7.2.4/7.2.x -> 7.3.0/7.3.x; where the old text tied the ^4.2.0 peer range to "7.2.x" it now reads "7.2.x and later", because 7.3.0 keeps that same peer range. Historical "since"/"added in" version notes are untouched. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01D7Ygtnje2DAqQ4FmgWhYnt --- sdk/javascript/offline-cached-data.mdx | 2 +- sdk/javascript/offline-enable.mdx | 4 ++-- sdk/javascript/offline-encryption.mdx | 2 +- sdk/javascript/offline-media-caching.mdx | 2 +- sdk/javascript/offline-overview.mdx | 4 ++-- sdk/javascript/offline-reference.mdx | 4 ++-- sdk/javascript/offline-send.mdx | 2 +- sdk/javascript/offline-sync.mdx | 2 +- ui-kit/react/core-features.mdx | 2 +- ui-kit/react/integration-astro.mdx | 4 ++-- ui-kit/react/integration-nextjs.mdx | 4 ++-- ui-kit/react/integration-react-router.mdx | 4 ++-- ui-kit/react/integration-react.mdx | 4 ++-- ui-kit/react/methods.mdx | 2 +- ui-kit/react/migration-overview.mdx | 8 ++++---- ui-kit/react/offline-support.mdx | 8 ++++---- ui-kit/react/overview.mdx | 6 +++--- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/sdk/javascript/offline-cached-data.mdx b/sdk/javascript/offline-cached-data.mdx index 2be4a813e..d7a840389 100644 --- a/sdk/javascript/offline-cached-data.mdx +++ b/sdk/javascript/offline-cached-data.mdx @@ -50,7 +50,7 @@ Three rules follow from this: - **The Promise still settles too.** Passing a listener does not replace the returned Promise: it settles on the server outcome, so it also **rejects** offline. If you use only the listener, add a `.catch()` to avoid an unhandled rejection. Consume the result from one channel, not both. -With offline support **off**, these listeners behave like the classic Promise: the cached phase never fires, and the server result arrives in `onServer…`. Nothing changes until you enable offline (see [Enable Offline Support](/sdk/javascript/offline-enable)). Requires SDK **4.3.0** or later. +With offline support **off**, these listeners behave like the classic Promise: the cached phase never fires, and the server result arrives in `onServer…`. Nothing changes until you enable offline (see [Enable Offline Support](/sdk/javascript/offline-enable)). Requires SDK **4.3.1** or later. ## Read messages diff --git a/sdk/javascript/offline-enable.mdx b/sdk/javascript/offline-enable.mdx index 7a5852d09..96a952cf7 100644 --- a/sdk/javascript/offline-enable.mdx +++ b/sdk/javascript/offline-enable.mdx @@ -29,10 +29,10 @@ Offline support is **off by default**. You turn it on once, at initialization, b -Offline support requires CometChat JavaScript SDK **4.3.0** or later. +Offline support requires CometChat JavaScript SDK **4.3.1** or later. ```bash -npm install @cometchat/chat-sdk-javascript@4.3.0 +npm install @cometchat/chat-sdk-javascript@4.3.1 ``` If you are new to the SDK, complete the [standard setup](/sdk/javascript/setup-sdk) first; the steps below only add offline configuration to your existing `init`. diff --git a/sdk/javascript/offline-encryption.mdx b/sdk/javascript/offline-encryption.mdx index a140c0b8e..e1f8b5472 100644 --- a/sdk/javascript/offline-encryption.mdx +++ b/sdk/javascript/offline-encryption.mdx @@ -33,7 +33,7 @@ status.leakage; // what is never covered Offline support keeps the logged-in user's messages in a local store on the device. Turn encryption on to store that content **encrypted at rest**. Encryption is **opt-in** and off by default; nothing changes until you set `encryption: true`. -This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What is and isn't encrypted](#what-is-and-isn-t-encrypted). Requires SDK **4.3.0** or later. +This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What is and isn't encrypted](#what-is-and-isn-t-encrypted). Requires SDK **4.3.1** or later. ## Requirements diff --git a/sdk/javascript/offline-media-caching.mdx b/sdk/javascript/offline-media-caching.mdx index f4d9123f7..68765e100 100644 --- a/sdk/javascript/offline-media-caching.mdx +++ b/sdk/javascript/offline-media-caching.mdx @@ -46,7 +46,7 @@ CometChat.addMediaDownloadListener("MEDIA_LISTENER", new CometChat.MediaDownload With offline support on, the SDK can cache attachment bytes durably on the device so media stays viewable offline — even after the server's signed URL has expired. This page covers the caching modes, how to read cached bytes, and how to download media on demand. -Media caching applies only while offline support is active for the logged-in user (`CometChat.isOfflineEnabled()` is `true`). See [Enable Offline Support](/sdk/javascript/offline-enable). In a browser, media bytes are kept in the Origin Private File System (OPFS); **where OPFS is not available, media is not cached** (messages and attachment metadata still are). +Media caching applies only while offline support is active for the logged-in user (`CometChat.isOfflineEnabled()` is `true`). See [Enable Offline Support](/sdk/javascript/offline-enable). In a browser, media bytes are kept in the Origin Private File System (OPFS); **where OPFS is not available, media is not cached** (messages and attachment metadata still are). Requires SDK **4.3.1** or later. ## Caching modes diff --git a/sdk/javascript/offline-overview.mdx b/sdk/javascript/offline-overview.mdx index 2e734a126..44d76837a 100644 --- a/sdk/javascript/offline-overview.mdx +++ b/sdk/javascript/offline-overview.mdx @@ -8,7 +8,7 @@ description: "Understand how local caching, the send outbox, and reconnect catch ```javascript -// Offline support is OFF by default. Turn it on at init (SDK 4.3.0 or later). +// Offline support is OFF by default. Turn it on at init (SDK 4.3.1 or later). const appSetting = new CometChat.AppSettingsBuilder() .setRegion("REGION") .setOfflineConfig({ enabled: true }) // or .offline(true) for defaults @@ -25,7 +25,7 @@ const active = CometChat.isOfflineEnabled(); // boolean Offline support keeps the logged-in user's conversations and messages on the device so your app can show them instantly, lets the user send messages while disconnected, and catches up automatically when the connection returns. It is **off by default** — nothing changes in your app until you enable it ([Enable Offline Support](/sdk/javascript/offline-enable)). This page explains the mental model; the other pages show the exact APIs. -Offline support ships in CometChat JavaScript SDK **4.3.0** or later. It runs in the browser (IndexedDB, with OPFS for media) and in Electron (SQLite). See [Enable Offline Support](/sdk/javascript/offline-enable#supported-runtimes). +Offline support ships in CometChat JavaScript SDK **4.3.1** or later. It runs in the browser (IndexedDB, with OPFS for media) and in Electron (SQLite). See [Enable Offline Support](/sdk/javascript/offline-enable#supported-runtimes). ## How it works diff --git a/sdk/javascript/offline-reference.mdx b/sdk/javascript/offline-reference.mdx index 87d706125..a5aaf858f 100644 --- a/sdk/javascript/offline-reference.mdx +++ b/sdk/javascript/offline-reference.mdx @@ -9,7 +9,7 @@ description: "Every offline configuration option, method, listener, enum, model | Field | Value | | --- | --- | -| Package | `@cometchat/chat-sdk-javascript` (offline requires **4.3.0** or later) | +| Package | `@cometchat/chat-sdk-javascript` (offline requires **4.3.1** or later) | | Enable | `new CometChat.AppSettingsBuilder().setOfflineConfig({ enabled: true, … })` or `.offline(true)` | | Verify | `CometChat.isOfflineEnabled()` | | Reads | Pass a `…FetchListener` to `fetchNext()` / `fetchPrevious()` / `getConversation()` / `getMessageDetails()` | @@ -22,7 +22,7 @@ description: "Every offline configuration option, method, listener, enum, model This page is the complete lookup for offline support in the CometChat JavaScript SDK. For guided walkthroughs, start with [Offline Support](/sdk/javascript/offline-overview). -Offline support requires SDK **4.3.0** or later. +Offline support requires SDK **4.3.1** or later. ## OfflineConfig options diff --git a/sdk/javascript/offline-send.mdx b/sdk/javascript/offline-send.mdx index bcfc5c898..dc7e42766 100644 --- a/sdk/javascript/offline-send.mdx +++ b/sdk/javascript/offline-send.mdx @@ -42,7 +42,7 @@ CometChat.addOfflineMessageListener("LISTENER_ID", new CometChat.OfflineMessageL With offline support enabled, a message you send while the device has no connection is **durably queued on the device** instead of failing. It keeps its place across a page reload or app restart and is sent automatically once the connection is back and stable (with `autoSendPendingOnReconnect` on, the default). This page shows the offline-aware send listener, how to read a message's status, how to inspect and recover the send queue, and the queue limits. -Offline support is **off by default** and requires SDK **4.3.0** or later. Queuing only happens once you [enable it](/sdk/javascript/offline-enable) **and** pass a `MessageSentListener`. A bare `await CometChat.sendMessage(message)` with no listener is never queued: offline, it rejects at once, as before. +Offline support is **off by default** and requires SDK **4.3.1** or later. Queuing only happens once you [enable it](/sdk/javascript/offline-enable) **and** pass a `MessageSentListener`. A bare `await CometChat.sendMessage(message)` with no listener is never queued: offline, it rejects at once, as before. ## Send a Message diff --git a/sdk/javascript/offline-sync.mdx b/sdk/javascript/offline-sync.mdx index c3616f6c2..6e0f1af3f 100644 --- a/sdk/javascript/offline-sync.mdx +++ b/sdk/javascript/offline-sync.mdx @@ -38,7 +38,7 @@ await CometChat.clearOfflineCache(); // destructive; drops the When the connection comes back, the SDK runs a **catch-up sync**: it refreshes the conversation list, then replays everything that changed in your messages since the last sync, and merges the results into the local cache. This page covers how to observe that sync, trigger one on demand, and manage the cache it maintains. -Everything on this page is a no-op unless offline support is active for the logged-in user (`CometChat.isOfflineEnabled()` is `true`). See [Enable Offline Support](/sdk/javascript/offline-enable). +Everything on this page is a no-op unless offline support is active for the logged-in user (`CometChat.isOfflineEnabled()` is `true`). See [Enable Offline Support](/sdk/javascript/offline-enable). Requires SDK **4.3.1** or later. ## How catch-up works diff --git a/ui-kit/react/core-features.mdx b/ui-kit/react/core-features.mdx index bd53cd13d..c7a6b3273 100644 --- a/ui-kit/react/core-features.mdx +++ b/ui-kit/react/core-features.mdx @@ -310,7 +310,7 @@ See the [Groups](/ui-kit/react/components/groups) component page for details. ## Offline Support -With offline support turned on, chats and messages the user has already opened appear at once from a cache on the device, messages sent while offline are queued and sent automatically on reconnect, and each list tells the user when something needs a connection ("Connect to load chats", "Connect to search", "Connect to load more"). Offline support is off by default; turn it on with `setOfflineConfig()` on the `UIKitSettingsBuilder`. It needs React UI Kit 7.3.0 and JavaScript Chat SDK 4.3.0 or later. +With offline support turned on, chats and messages the user has already opened appear at once from a cache on the device, messages sent while offline are queued and sent automatically on reconnect, and each list tells the user when something needs a connection ("Connect to load chats", "Connect to search", "Connect to load more"). Offline support is off by default; turn it on with `setOfflineConfig()` on the `UIKitSettingsBuilder`. It needs React UI Kit 7.3.0 and JavaScript Chat SDK 4.3.1 or later. | Components | Functionality | | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | diff --git a/ui-kit/react/integration-astro.mdx b/ui-kit/react/integration-astro.mdx index 621c13f4b..88e617725 100644 --- a/ui-kit/react/integration-astro.mdx +++ b/ui-kit/react/integration-astro.mdx @@ -17,7 +17,7 @@ description: "Add CometChat to an Astro app in 5 steps: create project, install, | Auth Key | Dev/testing only. Use Auth Token in production | | SSR | Use `client:only="react"` directive — CometChat components cannot be server-rendered | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | -| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) · [Next.js](/ui-kit/react/integration-nextjs) · [React Router](/ui-kit/react/integration-react-router) | @@ -164,7 +164,7 @@ For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login -To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support). --- diff --git a/ui-kit/react/integration-nextjs.mdx b/ui-kit/react/integration-nextjs.mdx index 7fc81d072..2c7e25c3a 100644 --- a/ui-kit/react/integration-nextjs.mdx +++ b/ui-kit/react/integration-nextjs.mdx @@ -17,7 +17,7 @@ description: "Add CometChat to a Next.js (App Router) app in 5 steps: create pro | Auth Key | Dev/testing only. Use `loginWithAuthToken` in production | | SSR | CometChat components must be loaded with `dynamic(() => import(...), { ssr: false })` | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | -| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) · [React Router](/ui-kit/react/integration-react-router) · [Astro](/ui-kit/react/integration-astro) | @@ -164,7 +164,7 @@ For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login -To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support). --- diff --git a/ui-kit/react/integration-react-router.mdx b/ui-kit/react/integration-react-router.mdx index e957d2ec5..a3074b8ef 100644 --- a/ui-kit/react/integration-react-router.mdx +++ b/ui-kit/react/integration-react-router.mdx @@ -17,7 +17,7 @@ description: "Add CometChat to a React Router app in 5 steps: create project, in | Auth Key | Dev/testing only. Use Auth Token in production | | SSR | N/A — client-side SPA by default | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | -| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [React.js](/ui-kit/react/integration-react) · [Next.js](/ui-kit/react/integration-nextjs) · [Astro](/ui-kit/react/integration-astro) | @@ -182,7 +182,7 @@ For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login -To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support). --- diff --git a/ui-kit/react/integration-react.mdx b/ui-kit/react/integration-react.mdx index b35489136..764bf2e5f 100644 --- a/ui-kit/react/integration-react.mdx +++ b/ui-kit/react/integration-react.mdx @@ -16,7 +16,7 @@ description: "Add CometChat to a React.js app in 4 steps: create project, instal | Order | `init()` → `login()` → render ``. Breaking this order = blank screen | | Auth Key | Dev/testing only. Use Auth Token in production | | Calling | Optional. Install `@cometchat/calls-sdk-javascript` and call `.setCallingEnabled(true)` on `UIKitSettingsBuilder` | -| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) | +| Offline support | Optional, off by default. Call `.setOfflineConfig({ enabled: true })` on `UIKitSettingsBuilder`. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) | | Other frameworks | [Next.js](/ui-kit/react/integration-nextjs) · [React Router](/ui-kit/react/integration-react-router) · [Astro](/ui-kit/react/integration-astro) | @@ -176,7 +176,7 @@ For production, use `CometChatUIKit.loginWithAuthToken(token)` instead of `login -To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support). +To show saved chats without a network and queue messages sent while offline, add `.setOfflineConfig({ enabled: true })` to the `UIKitSettingsBuilder` before `build()`. It is off by default and needs `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support). diff --git a/ui-kit/react/methods.mdx b/ui-kit/react/methods.mdx index e64843015..fa7b0489e 100644 --- a/ui-kit/react/methods.mdx +++ b/ui-kit/react/methods.mdx @@ -93,7 +93,7 @@ Session storage is cleared when the browser tab is closed. Use this mode if you ### Enabling Offline Support -Offline support is off by default. To show saved chats and messages without a network and queue messages sent while offline, call `setOfflineConfig()` on the `UIKitSettingsBuilder` with `enabled: true`. It needs `@cometchat/chat-uikit-react` 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later; on an older SDK the setting has no effect. +Offline support is off by default. To show saved chats and messages without a network and queue messages sent while offline, call `setOfflineConfig()` on the `UIKitSettingsBuilder` with `enabled: true`. It needs `@cometchat/chat-uikit-react` 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later; on an older SDK the setting has no effect. ```tsx import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react"; diff --git a/ui-kit/react/migration-overview.mdx b/ui-kit/react/migration-overview.mdx index e066c8bf0..1988b4573 100644 --- a/ui-kit/react/migration-overview.mdx +++ b/ui-kit/react/migration-overview.mdx @@ -10,7 +10,7 @@ description: "Migration guide covering breaking changes, architecture shifts, an | --- | --- | | Package | `@cometchat/chat-uikit-react` v6 → v7 | | React minimum | `>=18.0.0 <21.0.0` | -| SDK peer dep | `@cometchat/chat-sdk-javascript` ^4.2.0 (required by 7.2.x) | +| SDK peer dep | `@cometchat/chat-sdk-javascript` ^4.2.0 (required by 7.2.x and later) | | Bundled deps | `dompurify` (new in v7) and `@cometchat/cards-react` (already a dependency since 6.5.0) — installed automatically, not peer deps | | Removed dep | `rxjs` (no longer needed) | | Stylesheet | Delete the v6 `css-variables.css` import — v7 loads its own styles | @@ -48,8 +48,8 @@ npm uninstall rxjs # No longer needed for CometChat | Package | v6 | v7 | | --- | --- | --- | -| `@cometchat/chat-uikit-react` | `^6.x` | `^7.2.4` | -| `@cometchat/chat-sdk-javascript` | `^4.x` | `^4.2.0` — peer dep, required by 7.2.x | +| `@cometchat/chat-uikit-react` | `^6.x` | `^7.3.0` | +| `@cometchat/chat-sdk-javascript` | `^4.x` | `^4.2.0` — peer dep, required by 7.2.x and later | | `react` | `>=18` | `>=18 <21` | | `rxjs` | Required | Not needed — uninstall it | | `@cometchat/calls-sdk-javascript` | Optional | Optional (unchanged) | @@ -59,7 +59,7 @@ npm uninstall rxjs # No longer needed for CometChat `dompurify` and `@cometchat/cards-react` are regular dependencies of the UI Kit, so npm pulls them in automatically. They are not peer dependencies and do not belong in your `package.json`. -Bump your SDK first. 7.2.x declares `@cometchat/chat-sdk-javascript` `^4.2.0`, so staying on a 4.1.x pin fails with `ERESOLVE` — `^4` is not sufficient. Installing `^4.2.0` is safe on every v7 release, including 7.0.x and 7.1.x, whose ranges it also satisfies. +Bump your SDK first. 7.2.x and later declare `@cometchat/chat-sdk-javascript` `^4.2.0`, so staying on a 4.1.x pin fails with `ERESOLVE` — `^4` is not sufficient. Installing `^4.2.0` is safe on every v7 release, including 7.0.x and 7.1.x, whose ranges it also satisfies. **Delete your v6 stylesheet import.** v6 required you to import the base stylesheet yourself: diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 13f5c978c..71487a534 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -8,7 +8,7 @@ description: "Show saved chats and messages without a network, queue sends until | Field | Value | | --- | --- | -| Package | `@cometchat/chat-uikit-react` 7.3.0 or later, with `@cometchat/chat-sdk-javascript` 4.3.0 or later | +| Package | `@cometchat/chat-uikit-react` 7.3.0 or later, with `@cometchat/chat-sdk-javascript` 4.3.1 or later | | Default | **Off.** Nothing changes until you call `setOfflineConfig()` with `enabled: true` | | Enable | `new UIKitSettingsBuilder()...setOfflineConfig({ enabled: true }).build()`, then `CometChatUIKit.init(settings)` | | Config | Passed to the SDK's `AppSettingsBuilder.setOfflineConfig()` unchanged. Options: [Configuration & API Reference](/sdk/javascript/offline-reference#offlineconfig-options) | @@ -46,13 +46,13 @@ The UI Kit builds on [offline support in the JavaScript SDK](/sdk/javascript/off | Requirement | Version | | --- | --- | | React UI Kit | `@cometchat/chat-uikit-react` **7.3.0** or later | -| JavaScript Chat SDK | `@cometchat/chat-sdk-javascript` **4.3.0** or later | +| JavaScript Chat SDK | `@cometchat/chat-sdk-javascript` **4.3.1** or later | | React | 18 or later (the UI Kit's peer range is `>=18.0.0 <21.0.0`) | -The UI Kit's peer dependency on the Chat SDK stays `^4.2.0`, so upgrading the UI Kit does not force an SDK upgrade. On an SDK older than 4.3.0, `setOfflineConfig()` has no effect and the UI Kit works online as before. Install 4.3.0 or later to use offline support: +The UI Kit's peer dependency on the Chat SDK stays `^4.2.0`, so upgrading the UI Kit does not force an SDK upgrade. On an SDK older than 4.3.1, `setOfflineConfig()` has no effect and the UI Kit works online as before. Install 4.3.1 or later to use offline support: ```bash -npm install @cometchat/chat-uikit-react@^7.3.0 @cometchat/chat-sdk-javascript@^4.3.0 +npm install @cometchat/chat-uikit-react@^7.3.0 @cometchat/chat-sdk-javascript@^4.3.1 ``` Offline support is for UI Kit v7 only. UI Kit v6 and earlier have no offline UI, and turning on the SDK's offline support with them is not supported. diff --git a/ui-kit/react/overview.mdx b/ui-kit/react/overview.mdx index 7b23d71f5..02d148101 100644 --- a/ui-kit/react/overview.mdx +++ b/ui-kit/react/overview.mdx @@ -67,7 +67,7 @@ Pick your framework and follow the step-by-step integration guide: - **Theming** — CSS custom properties (`--cometchat-*`) with built-in light and dark themes - **Localization** — 19 supported languages with customizable translation keys - **Calling** — optional voice and video calling via `@cometchat/calls-sdk-javascript` -- **Offline support** — optional, off by default: saved chats and messages without a network, and queued sends. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.0 or later. See [Offline Support](/ui-kit/react/offline-support) +- **Offline support** — optional, off by default: saved chats and messages without a network, and queued sends. Needs UI Kit 7.3.0 and `@cometchat/chat-sdk-javascript` 4.3.1 or later. See [Offline Support](/ui-kit/react/offline-support) - **SSR-safe** — no browser-only APIs at module scope; Next.js App Router compatible - **Tree-shakeable** — ESM-first build with dual ESM + CJS output @@ -93,7 +93,7 @@ npm install @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript react rea | Package | Version | Install | |---------|---------|---------| -| `@cometchat/chat-uikit-react` | `^7.2.4` (latest) | Yes | +| `@cometchat/chat-uikit-react` | `^7.3.0` (latest) | Yes | | `@cometchat/chat-sdk-javascript` | `^4.2.0` | Yes — peer dependency | | `react` | `>=18.0.0 <21.0.0` | Yes — peer dependency | | `react-dom` | `>=18.0.0 <21.0.0` | Yes — peer dependency | @@ -104,7 +104,7 @@ npm install @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript react rea `dompurify` and `@cometchat/cards-react` are regular dependencies of the UI Kit, not peer dependencies, so npm installs them for you. Adding them to your own `package.json` is unnecessary and risks pinning a version the UI Kit was not tested against. -The versions above are correct as of `@cometchat/chat-uikit-react@7.2.x`, and `@cometchat/chat-sdk-javascript` `^4.2.0` also satisfies every earlier 7.x release, so it is safe whichever v7 version you are on. If you are pinned to an older SDK for unrelated reasons, the floor rises per release: 7.0.3 needs 4.1.12, 7.1.0 needs 4.1.13 and 7.2.x needs 4.2.0. The authoritative range is always the `peerDependencies` block of the version you install — check it with `npm view @cometchat/chat-uikit-react@ peerDependencies`. +The versions above are correct as of `@cometchat/chat-uikit-react@7.3.x`, and `@cometchat/chat-sdk-javascript` `^4.2.0` also satisfies every earlier 7.x release, so it is safe whichever v7 version you are on. If you are pinned to an older SDK for unrelated reasons, the floor rises per release: 7.0.3 needs 4.1.12, 7.1.0 needs 4.1.13, and 7.2.x and 7.3.x need 4.2.0 (offline support additionally needs 4.3.1). The authoritative range is always the `peerDependencies` block of the version you install — check it with `npm view @cometchat/chat-uikit-react@ peerDependencies`. --- From 75b3a29e89957bbef6fda371ff706b5e242ebc0d Mon Sep 17 00:00:00 2001 From: rajdubey Date: Mon, 23 Nov 2026 20:02:54 +0530 Subject: [PATCH 08/13] docs(ENG-57590): remove duplicate-message mentions from React UI Kit offline docs Public docs must not mention duplicate messages from offline sends, even indirectly (Aditya, 23 Nov). Removes the lost-send-acknowledgement bullet from "Limitations and known issues". Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01D7Ygtnje2DAqQ4FmgWhYnt --- ui-kit/react/offline-support.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 71487a534..10e4680ca 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -369,7 +369,6 @@ Apps that don't call `setOfflineConfig()` get no offline UI, no offline events a - **Only what was loaded online is saved.** A user who has never opened a chat or list while online has nothing to show offline. - **Thread replies opened online are not saved for offline.** Replies sent or received on this device are saved. -- **A lost send acknowledgement can create one duplicate** of that message on the server. - **Missed messages can take up to about 10 seconds** to appear after a quick reconnect. - **After a page reload, a failed message's reason may be unknown.** It is still offered Retry. - **A chat can stall while online** if a send got no answer while connected. It resumes at the next reconnect. From 154ebb1839b0c5dd9cfa6f6c7907ed462bb50a61 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Tue, 24 Nov 2026 15:21:15 +0530 Subject: [PATCH 09/13] docs(ENG-57332): fix the React send-promise discard code Review fixes on the React offline docs, checked against UI Kit 7.3.0. - offline-support.mdx said a removal for a reason other than logout, user switch or cache reset rejects "with its failure reason as the code (DISCARDED)". Every removal rejects with ERROR_OFFLINE_MESSAGE_DISCARDED (utils/offline/send.ts:285, :311-315, :331-335), so err.code === 'DISCARDED' never matched. Correct it, name the other triggers, and document sentMessage. - Complete the same list in the quick reference and in methods.mdx. - Add an "Offline Support Does Nothing" section to troubleshooting: the three silent-failure causes (SDK below 4.3.1, setOfflineConfig not passed before init, nobody logged in) and how to check each. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XbguTu9in5yKt5CNV4rjXF --- ui-kit/react/methods.mdx | 2 +- ui-kit/react/offline-support.mdx | 5 +++-- ui-kit/react/troubleshooting.mdx | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/ui-kit/react/methods.mdx b/ui-kit/react/methods.mdx index fa7b0489e..d54958c70 100644 --- a/ui-kit/react/methods.mdx +++ b/ui-kit/react/methods.mdx @@ -275,7 +275,7 @@ Get conversation update settings fetched from the dashboard. While a `CometChatProvider` is mounted, these methods publish `ui:message/sent` (in progress, then success or error), so a mounted `CometChatMessageList` and `CometChatConversations` show the message without any extra code. Don't publish `ui:message/sent` again yourself for the same send. -With [offline support](/ui-kit/react/offline-support) on, the returned Promise resolves when the message is actually sent. A message the SDK queues while offline does not reject it. A logout, a user switch or a cache reset that lost (or may have lost) unsent messages before it is sent rejects the Promise with the code `ERROR_OFFLINE_MESSAGE_DISCARDED`. See [Send promises](/ui-kit/react/offline-support#send-promises). +With [offline support](/ui-kit/react/offline-support) on, the returned Promise resolves when the message is actually sent. A message the SDK queues while offline does not reject it. Any removal of the message before it is sent rejects the Promise with the code `ERROR_OFFLINE_MESSAGE_DISCARDED`: a logout, a user switch, a cache reset that lost (or may have lost) unsent messages, the user's own **Delete**, or the outbox discarding it. The reason behind the removal is never the rejection's `code`. See [Send promises](/ui-kit/react/offline-support#send-promises). ### `CometChatUIKit.sendTextMessage(message)` diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 10e4680ca..959466171 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -15,7 +15,7 @@ description: "Show saved chats and messages without a network, queue sends until | Runtime check | `CometChat.isOfflineEnabled()` from `@cometchat/chat-sdk-javascript` | | Props | `hideOfflineNotices` on `CometChatMessageList` and `CometChatConversations` (default `false`) | | Events | `ui:message/send-state-changed`, `ui:offline/cache-reset` via `useCometChatEvents` | -| Send promise | `CometChatUIKit.sendTextMessage` / `sendMediaMessage` / `sendCustomMessage` resolve when sent; a logout, user switch, or cache reset that lost (or may have lost) unsent messages rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` | +| Send promise | `CometChatUIKit.sendTextMessage` / `sendMediaMessage` / `sendCustomMessage` resolve when sent; any removal before the send (logout, user switch, cache reset, the user's **Delete**, an outbox discard or overflow) rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` | | Styling | `--cometchat-message-bubble-offline-*`, `--cometchat-message-list-offline-*`, `--cometchat-conversations-offline-*`, `--cometchat-offline-media-unavailable-*` CSS variables | @@ -234,7 +234,8 @@ localize?.addTranslation({ `CometChatUIKit.sendTextMessage()`, `sendMediaMessage()` and `sendCustomMessage()` answer every send: - Queueing a message does not reject the promise. It resolves when the message is sent, and rejects once if the message fails or is removed before it is sent. A later **Retry** does not answer the same promise again. -- A logout or user switch, or a cache reset that lost (or may have lost) unsent messages, rejects the promise with an error whose `code` is `ERROR_OFFLINE_MESSAGE_DISCARDED`. A message removed later for another reason, for example the user's own **Delete**, rejects with its failure reason as the `code` (`DISCARDED`). +- Any removal of the message before it is sent rejects the promise with an error whose `code` is `ERROR_OFFLINE_MESSAGE_DISCARDED`. That covers a logout or user switch, a cache reset that lost (or may have lost) unsent messages, the user's own **Delete**, and the outbox discarding the message or dropping it on overflow. The reason behind the removal is never the rejection's `code`, so check `err.code === "ERROR_OFFLINE_MESSAGE_DISCARDED"` to tell a removal from a failure. The error carries the removed message as `sentMessage`. +- A send that *fails* rejects with the SDK's own error, or with an `Error` whose `code` is the failure reason. - The UI Kit shows nothing for an `ERROR_OFFLINE_MESSAGE_DISCARDED` rejection: no error toast, no `onError`, and the composer does not lock. Only your own `.catch` hears of it. ```tsx diff --git a/ui-kit/react/troubleshooting.mdx b/ui-kit/react/troubleshooting.mdx index 5530b0602..a38756821 100644 --- a/ui-kit/react/troubleshooting.mdx +++ b/ui-kit/react/troubleshooting.mdx @@ -202,3 +202,35 @@ Then pass the custom theme name to the provider: ```tsx ``` +--- + +## Offline Support Does Nothing + +### Symptom + +Offline support is turned on, but nothing changes: no offline states, no queued sends, no **Not sent yet** rows, and neither `ui:message/send-state-changed` nor `ui:offline/cache-reset` ever fires. No error is thrown and nothing is logged. + +### Root Cause + +The UI Kit skips the offline layer silently in three cases: + +- `@cometchat/chat-sdk-javascript` is older than 4.3.1. The SDK's own offline support ships in 4.3.0, but the UI Kit also needs the `SCHEMA_RESET` cache-reset reason added in 4.3.1. The UI Kit's peer range does not enforce it, so an existing lockfile can upgrade the UI Kit while leaving the SDK behind. +- `setOfflineConfig({ enabled: true })` was not passed to the `AppSettingsBuilder` before `CometChatUIKit.init()`. +- No user is logged in. Offline support is active only during a session. + +### Solution + +```bash +npm ls @cometchat/chat-sdk-javascript # must be 4.3.1 or later +``` + +```tsx +// after login +import { CometChat } from "@cometchat/chat-sdk-javascript"; + +console.log(CometChat.isOfflineEnabled()); // must be true +``` + +If `isOfflineEnabled()` returns `false` with a 4.3.1 SDK and `enabled: true`, check that `setOfflineConfig` runs on the same `AppSettingsBuilder` instance you pass to `CometChatUIKit.init()`, and that the browser allows IndexedDB — a private window with site data blocked has no store to cache into. See [Supported runtimes](/sdk/javascript/offline-enable#supported-runtimes). + +Also note that an unhandled rejection with code `ERROR_OFFLINE_MESSAGE_DISCARDED` is **not** a failure: it means an unsent message was removed before it could send (logout, user switch, cache reset, the user's **Delete**, or an outbox discard). Add a `.catch` to your `send*` call and ignore that code. From 68aa9e5357212f89310bb9c469cf38cf0d5195a5 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Tue, 24 Nov 2026 15:49:47 +0530 Subject: [PATCH 10/13] docs(react): limitations list carries scope only, matching the Android and Flutter pages Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XbguTu9in5yKt5CNV4rjXF --- ui-kit/react/offline-support.mdx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 959466171..e547f4eca 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -366,14 +366,13 @@ Apps that don't call `setOfflineConfig()` get no offline UI, no offline events a - Saved Messages rows are no longer announced to screen readers as selectable options. - Message rows, conversation rows, notices, the composer input and the empty and error views carry new `data-cc` attributes for test automation. Existing `data-testid` and `data-message-id` attributes are kept, but DOM snapshot tests may change. -## Limitations and Known Issues +## Limitations - **Only what was loaded online is saved.** A user who has never opened a chat or list while online has nothing to show offline. - **Thread replies opened online are not saved for offline.** Replies sent or received on this device are saved. +- **Edits, deletes and reactions are not queued.** They need a connection when the user makes them. - **Missed messages can take up to about 10 seconds** to appear after a quick reconnect. - **After a page reload, a failed message's reason may be unknown.** It is still offered Retry. -- **A chat can stall while online** if a send got no answer while connected. It resumes at the next reconnect. -- **Multiple tabs:** a cache rebuild in one tab can discard another tab's unsent messages. That tab's rows update to match. - **Need a connection:** keyword search, message information, call logs and AI streamed replies. Call logs have no saved copy and keep their own error view. - **Encryption in the browser** covers the cached content but not its lookup metadata, and downloaded media is stored unencrypted. See [Encrypt the Cache](/sdk/javascript/offline-encryption). From e9d2efa49724d88c5e89dd5d3aaabd2a86294204 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Tue, 24 Nov 2026 16:14:57 +0530 Subject: [PATCH 11/13] docs(ENG-57332): correct the full-outbox error code and the UIKitSettings wording Verified against the published SDK 4.3.1 and UI Kit 7.3.0: - A refused send reports code ERROR_PENDING_QUEUE_LIMIT (reason QUEUE_FULL) with details.maxPendingMessages; BYTE_OVERFLOW keeps its own code. The pages said the code was QUEUE_FULL, which was true for 4.3.0 only. - Troubleshooting said setOfflineConfig goes on AppSettingsBuilder; CometChatUIKit.init() takes UIKitSettings, built by UIKitSettingsBuilder. - Attachments picked offline are queued (sendBatch), not "not guaranteed". - Limitations carries scope only; the 10-second catch-up, the unknown failure reason after a reload and the thread-replies item are tracked as known issues in the kit's release notes, not in the docs. - Neutral wording for the offline-off behaviour changes; fixed the what-is-and-isnt-encrypted anchor. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XbguTu9in5yKt5CNV4rjXF --- sdk/javascript/offline-encryption.mdx | 2 +- sdk/javascript/offline-reference.mdx | 2 +- sdk/javascript/offline-send.mdx | 2 +- ui-kit/react/offline-support.mdx | 15 ++++++--------- ui-kit/react/troubleshooting.mdx | 8 ++++---- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sdk/javascript/offline-encryption.mdx b/sdk/javascript/offline-encryption.mdx index e1f8b5472..1433e50fb 100644 --- a/sdk/javascript/offline-encryption.mdx +++ b/sdk/javascript/offline-encryption.mdx @@ -33,7 +33,7 @@ status.leakage; // what is never covered Offline support keeps the logged-in user's messages in a local store on the device. Turn encryption on to store that content **encrypted at rest**. Encryption is **opt-in** and off by default; nothing changes until you set `encryption: true`. -This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What is and isn't encrypted](#what-is-and-isn-t-encrypted). Requires SDK **4.3.1** or later. +This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What is and isn't encrypted](#what-is-and-isnt-encrypted). Requires SDK **4.3.1** or later. ## Requirements diff --git a/sdk/javascript/offline-reference.mdx b/sdk/javascript/offline-reference.mdx index a5aaf858f..feba15a1b 100644 --- a/sdk/javascript/offline-reference.mdx +++ b/sdk/javascript/offline-reference.mdx @@ -158,7 +158,7 @@ The offline-related codes the SDK raises: | `ERROR_OFFLINE_MESSAGE_IN_FLIGHT` | `retryMessage` / `discardLocalMessage` targeted a message that is already being sent. Constant: `CometChat.ERROR_OFFLINE_MESSAGE_IN_FLIGHT`. | | `ERROR_OFFLINE_MESSAGE_NOT_FOUND` | `retryMessage` / `discardLocalMessage` found no unsent message with the given local id. Constant: `CometChat.ERROR_OFFLINE_MESSAGE_NOT_FOUND`. | | `ERROR_OFFLINE_MESSAGE_PERSIST_FAILED` | The local cache was briefly unavailable, so `getPendingMessages`, `retryMessage`, `retryAllFailedMessages` or `discardLocalMessage` could not read it. Try again. | -| `QUEUE_FULL` | A send was refused because the outbox is full; `details.maxPendingMessages` holds the cap. | +| `ERROR_PENDING_QUEUE_LIMIT` | A send was refused because the outbox is full (failure reason `QUEUE_FULL`); `details.maxPendingMessages` holds the cap. | | `PERMANENT` / `BYTE_OVERFLOW` | A media send was refused before it was queued: its file could not be copied (`PERMANENT`), or one of its files is larger than `maxMediaCacheSize` (`BYTE_OVERFLOW`). | | `REQUEST_IN_PROGRESS` | A fetch was started on a messages, threads, reactions or notification-feed request while an earlier fetch on the same object is still running. | | `ERROR_OFFLINE_MEDIA_NO_URL` | `downloadMedia` was given no attachment, or an attachment without a URL. | diff --git a/sdk/javascript/offline-send.mdx b/sdk/javascript/offline-send.mdx index dc7e42766..1331a6fa4 100644 --- a/sdk/javascript/offline-send.mdx +++ b/sdk/javascript/offline-send.mdx @@ -349,7 +349,7 @@ The outbox holds at most `maxPendingMessages` messages still trying to send (`PE A media send with a file larger than `maxMediaCacheSize` is refused with reason `BYTE_OVERFLOW`; nothing is evicted to make room. -A **refused** send (`QUEUE_FULL` / `BYTE_OVERFLOW`) is never queued, so it fires **no** `onMessagePending`; it reports `onError`, and the global `OfflineMessageListener` receives `onOutboxMessageFailed(message, reason)` carrying the exact reason. For `QUEUE_FULL` the error's `code` is `QUEUE_FULL`, with `details.maxPendingMessages`. +A **refused** send (`QUEUE_FULL` / `BYTE_OVERFLOW`) is never queued, so it fires **no** `onMessagePending`; it reports `onError`, and the global `OfflineMessageListener` receives `onOutboxMessageFailed(message, reason)` carrying the exact reason. A `QUEUE_FULL` refusal reports `onError` with the code `ERROR_PENDING_QUEUE_LIMIT` and `details.maxPendingMessages`; a `BYTE_OVERFLOW` refusal reports the code `BYTE_OVERFLOW`. A refused or evicted message (`QUEUE_FULL`, `QUEUE_OVERFLOW`, `BYTE_OVERFLOW`) has **no durable row** — it does not appear in `getPendingMessages`, and `retryMessage` or `discardLocalMessage` on its id rejects with `ERROR_OFFLINE_MESSAGE_NOT_FOUND`. Capture these from the failure callback and handle them at that moment. Prefer the default `REJECT_NEWEST`, which never silently drops an already-queued message from another conversation. diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index e547f4eca..7afe3d798 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -31,6 +31,7 @@ The UI Kit builds on [offline support in the JavaScript SDK](/sdk/javascript/off - Conversations, users, groups, group members, messages, reactions, notifications, and pinned and saved messages the user has already loaded appear straight away from the cache. - Text messages, stickers and custom messages the user sends are queued and sent automatically on reconnect. - Media that was downloaded while online is shown from the device. +- Attachments (images, video, audio, files and voice notes) picked while offline are queued with the message and uploaded on reconnect, as long as the file fits in the media cache budget. A file that does not fit is refused at once with "File too large to send offline". - When the connection returns, the SDK catches up on what was missed and the lists update in place. **Needs a connection** @@ -39,7 +40,6 @@ The UI Kit builds on [offline support in the JavaScript SDK](/sdk/javascript/off - Keyword search with no saved match, and keyword search in the Search component. - Edits, deletes, reactions and other actions on messages that are already sent. They are not queued. (Retry and Delete on a message that is not sent yet work offline.) - Calls, call logs, message information and AI features such as streamed replies. -- Attachments (images, video, audio, files and voice notes) picked while offline are not guaranteed to send, so don't rely on them being queued. Send them when connected. ## Requirements @@ -235,7 +235,7 @@ localize?.addTranslation({ - Queueing a message does not reject the promise. It resolves when the message is sent, and rejects once if the message fails or is removed before it is sent. A later **Retry** does not answer the same promise again. - Any removal of the message before it is sent rejects the promise with an error whose `code` is `ERROR_OFFLINE_MESSAGE_DISCARDED`. That covers a logout or user switch, a cache reset that lost (or may have lost) unsent messages, the user's own **Delete**, and the outbox discarding the message or dropping it on overflow. The reason behind the removal is never the rejection's `code`, so check `err.code === "ERROR_OFFLINE_MESSAGE_DISCARDED"` to tell a removal from a failure. The error carries the removed message as `sentMessage`. -- A send that *fails* rejects with the SDK's own error, or with an `Error` whose `code` is the failure reason. +- A send that *fails* rejects with the SDK's own error, or with an `Error` whose `code` is the failure reason. A send that is **refused** before it is queued also rejects: with the code `ERROR_PENDING_QUEUE_LIMIT` when the outbox is already full (`details.maxPendingMessages` holds the cap), or `BYTE_OVERFLOW` when a media file does not fit in the media cache budget. - The UI Kit shows nothing for an `ERROR_OFFLINE_MESSAGE_DISCARDED` rejection: no error toast, no `onError`, and the composer does not lock. Only your own `.catch` hears of it. ```tsx @@ -357,11 +357,11 @@ Each variable falls back to the UI Kit's current theme value, so set only what y ## With Offline Support Turned Off -Apps that don't call `setOfflineConfig()` get no offline UI, no offline events and no change to how sends work. A few fixes in the same release do change what every app sees: +Apps that don't call `setOfflineConfig()` get no offline UI, no offline events and no change to how sends work. A few behaviour changes in the same release apply to every app: -- A message list that is empty when the connection returns now loads again and shows its empty state, instead of staying blank. -- A reconnect while the newest message is still unsent now fetches the messages missed during the outage. -- Paging past a conversation that just received a message no longer shows it twice. +- A message list that is empty when the connection returns loads again and shows its empty state. +- On reconnect, a list whose newest message is still unsent fetches the messages missed during the outage. +- Paging past a conversation that just received a message shows it once. - A `messagesRequestBuilder` you pass to `CometChatMessageList` or `CometChatSavedMessages` is no longer modified. - Saved Messages rows are no longer announced to screen readers as selectable options. - Message rows, conversation rows, notices, the composer input and the empty and error views carry new `data-cc` attributes for test automation. Existing `data-testid` and `data-message-id` attributes are kept, but DOM snapshot tests may change. @@ -369,10 +369,7 @@ Apps that don't call `setOfflineConfig()` get no offline UI, no offline events a ## Limitations - **Only what was loaded online is saved.** A user who has never opened a chat or list while online has nothing to show offline. -- **Thread replies opened online are not saved for offline.** Replies sent or received on this device are saved. - **Edits, deletes and reactions are not queued.** They need a connection when the user makes them. -- **Missed messages can take up to about 10 seconds** to appear after a quick reconnect. -- **After a page reload, a failed message's reason may be unknown.** It is still offered Retry. - **Need a connection:** keyword search, message information, call logs and AI streamed replies. Call logs have no saved copy and keep their own error view. - **Encryption in the browser** covers the cached content but not its lookup metadata, and downloaded media is stored unencrypted. See [Encrypt the Cache](/sdk/javascript/offline-encryption). diff --git a/ui-kit/react/troubleshooting.mdx b/ui-kit/react/troubleshooting.mdx index a38756821..a222552de 100644 --- a/ui-kit/react/troubleshooting.mdx +++ b/ui-kit/react/troubleshooting.mdx @@ -212,10 +212,10 @@ Offline support is turned on, but nothing changes: no offline states, no queued ### Root Cause -The UI Kit skips the offline layer silently in three cases: +The UI Kit skips the offline layer silently in these cases: -- `@cometchat/chat-sdk-javascript` is older than 4.3.1. The SDK's own offline support ships in 4.3.0, but the UI Kit also needs the `SCHEMA_RESET` cache-reset reason added in 4.3.1. The UI Kit's peer range does not enforce it, so an existing lockfile can upgrade the UI Kit while leaving the SDK behind. -- `setOfflineConfig({ enabled: true })` was not passed to the `AppSettingsBuilder` before `CometChatUIKit.init()`. +- `@cometchat/chat-sdk-javascript` is older than 4.3.1. The UI Kit needs the `SCHEMA_RESET` cache-reset reason, which first ships in 4.3.1. The UI Kit's peer range does not enforce it, so an existing lockfile can upgrade the UI Kit while leaving the SDK behind. +- `setOfflineConfig({ enabled: true })` was not set on the `UIKitSettingsBuilder` whose `UIKitSettings` you pass to `CometChatUIKit.init()`. - No user is logged in. Offline support is active only during a session. ### Solution @@ -231,6 +231,6 @@ import { CometChat } from "@cometchat/chat-sdk-javascript"; console.log(CometChat.isOfflineEnabled()); // must be true ``` -If `isOfflineEnabled()` returns `false` with a 4.3.1 SDK and `enabled: true`, check that `setOfflineConfig` runs on the same `AppSettingsBuilder` instance you pass to `CometChatUIKit.init()`, and that the browser allows IndexedDB — a private window with site data blocked has no store to cache into. See [Supported runtimes](/sdk/javascript/offline-enable#supported-runtimes). +If `isOfflineEnabled()` returns `false` with a 4.3.1 SDK and `enabled: true`, check that `setOfflineConfig` runs on the same `UIKitSettingsBuilder` that builds the `UIKitSettings` you pass to `CometChatUIKit.init()`, and that the browser allows IndexedDB — a private window with site data blocked has no store to cache into. See [Supported runtimes](/sdk/javascript/offline-enable#supported-runtimes). Also note that an unhandled rejection with code `ERROR_OFFLINE_MESSAGE_DISCARDED` is **not** a failure: it means an unsent message was removed before it could send (logout, user switch, cache reset, the user's **Delete**, or an outbox discard). Add a `.catch` to your `send*` call and ignore that code. From f6d4d3598706066f81b9fd36b21ea3bb7914b173 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Tue, 24 Nov 2026 16:17:36 +0530 Subject: [PATCH 12/13] docs: name the encryption section "What gets encrypted", as on Android, Flutter and React Native MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rendered id of "What is and isn't encrypted" keeps a typographic apostrophe (verified on the live page: id="what-is-and-isn’t-encrypted"), so the in-page link #what-is-and-isn-t-encrypted never resolved. Android, Flutter and React Native already head this section "What gets encrypted"; the JavaScript and iOS pages now match, with the link text unchanged. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XbguTu9in5yKt5CNV4rjXF --- sdk/javascript/offline-encryption.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/javascript/offline-encryption.mdx b/sdk/javascript/offline-encryption.mdx index 1433e50fb..5b142f49a 100644 --- a/sdk/javascript/offline-encryption.mdx +++ b/sdk/javascript/offline-encryption.mdx @@ -33,7 +33,7 @@ status.leakage; // what is never covered Offline support keeps the logged-in user's messages in a local store on the device. Turn encryption on to store that content **encrypted at rest**. Encryption is **opt-in** and off by default; nothing changes until you set `encryption: true`. -This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What is and isn't encrypted](#what-is-and-isnt-encrypted). Requires SDK **4.3.1** or later. +This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What is and isn't encrypted](#what-gets-encrypted). Requires SDK **4.3.1** or later. ## Requirements @@ -145,7 +145,7 @@ console.log( The most useful support signal is `enabled === true` with `cipherAvailable === false`: encryption was switched on but could not run. In a browser that almost always means an insecure origin; in Electron, a missing `better-sqlite3-multiple-ciphers` cipher build. Check `atRest` to see whether a cache was opened at all. -## What is and isn't encrypted +## What gets encrypted | Data | Encrypted at rest? | |---|---| From 97112728c33d27f22998fa6415cce16b08d75e23 Mon Sep 17 00:00:00 2001 From: rajdubey Date: Tue, 24 Nov 2026 17:32:53 +0530 Subject: [PATCH 13/13] docs(ENG-57590): align queued-content, version and anchor wording on review feedback Review feedback on #611: - The composer and core-features pages said only text messages and stickers are queued offline, while offline-support.mdx says text, stickers, custom messages and attachments. Both now name attachments and the media cache budget. - offline-overview.mdx said offline "ships in" 4.3.1. 4.3.0 is on npm and carried offline support; 4.3.1 only changed the full-outbox error code. Says "requires" now, as the other seven JS pages do. - offline-encryption.mdx still linked "What is and isn't encrypted" at the heading renamed to "What gets encrypted". - The Limitations list said a bare "keyword search" needs a connection, contradicting the Overview list on the same page. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XbguTu9in5yKt5CNV4rjXF --- sdk/javascript/offline-encryption.mdx | 2 +- sdk/javascript/offline-overview.mdx | 2 +- ui-kit/react/components/message-composer.mdx | 2 +- ui-kit/react/core-features.mdx | 2 +- ui-kit/react/offline-support.mdx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/javascript/offline-encryption.mdx b/sdk/javascript/offline-encryption.mdx index 5b142f49a..f76341b24 100644 --- a/sdk/javascript/offline-encryption.mdx +++ b/sdk/javascript/offline-encryption.mdx @@ -33,7 +33,7 @@ status.leakage; // what is never covered Offline support keeps the logged-in user's messages in a local store on the device. Turn encryption on to store that content **encrypted at rest**. Encryption is **opt-in** and off by default; nothing changes until you set `encryption: true`. -This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What is and isn't encrypted](#what-gets-encrypted). Requires SDK **4.3.1** or later. +This is not end-to-end encryption — the server still sees plaintext. It protects the on-device cache only. Cached **media files** are never encrypted, and in a browser some metadata stays readable so the cache can be queried. See [What gets encrypted](#what-gets-encrypted). Requires SDK **4.3.1** or later. ## Requirements diff --git a/sdk/javascript/offline-overview.mdx b/sdk/javascript/offline-overview.mdx index 44d76837a..fbce09a55 100644 --- a/sdk/javascript/offline-overview.mdx +++ b/sdk/javascript/offline-overview.mdx @@ -25,7 +25,7 @@ const active = CometChat.isOfflineEnabled(); // boolean Offline support keeps the logged-in user's conversations and messages on the device so your app can show them instantly, lets the user send messages while disconnected, and catches up automatically when the connection returns. It is **off by default** — nothing changes in your app until you enable it ([Enable Offline Support](/sdk/javascript/offline-enable)). This page explains the mental model; the other pages show the exact APIs. -Offline support ships in CometChat JavaScript SDK **4.3.1** or later. It runs in the browser (IndexedDB, with OPFS for media) and in Electron (SQLite). See [Enable Offline Support](/sdk/javascript/offline-enable#supported-runtimes). +Offline support requires CometChat JavaScript SDK **4.3.1** or later. It runs in the browser (IndexedDB, with OPFS for media) and in Electron (SQLite). See [Enable Offline Support](/sdk/javascript/offline-enable#supported-runtimes). ## How it works diff --git a/ui-kit/react/components/message-composer.mdx b/ui-kit/react/components/message-composer.mdx index 18e80a028..6a31477f9 100644 --- a/ui-kit/react/components/message-composer.mdx +++ b/ui-kit/react/components/message-composer.mdx @@ -162,7 +162,7 @@ The component handles: - Edit and reply mode with preview banners - Typing indicator events - Live reactions -- Offline support (when turned on) — a text message or sticker sent without a connection is queued and goes out on reconnect. See [Offline Support](/ui-kit/react/offline-support) +- Offline support (when turned on) — a text message, sticker, custom message or attachment sent without a connection is queued and goes out on reconnect. An attachment is queued only if it fits in the media cache budget; a file that does not fit is refused at once with "File too large to send offline". See [Offline Support](/ui-kit/react/offline-support) --- diff --git a/ui-kit/react/core-features.mdx b/ui-kit/react/core-features.mdx index c7a6b3273..3da1f6911 100644 --- a/ui-kit/react/core-features.mdx +++ b/ui-kit/react/core-features.mdx @@ -316,7 +316,7 @@ With offline support turned on, chats and messages the user has already opened a | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | [Conversations](/ui-kit/react/components/conversations) | Shows saved conversations first, then merges in the server's list. Shows a notice if unsent messages were lost in a cache reset. | | [Message List](/ui-kit/react/components/message-list) | Opens chats from the cache, marks queued and failed messages, and offers Retry and Delete on unsent messages. | -| [Message Composer](/ui-kit/react/components/message-composer) | Queues text messages and stickers sent while offline. | +| [Message Composer](/ui-kit/react/components/message-composer) | Queues text messages, stickers, custom messages and attachments that fit the media cache budget, sent while offline. | | [Users](/ui-kit/react/components/users), [Groups](/ui-kit/react/components/groups), [Group Members](/ui-kit/react/components/group-members) | Show saved rows first, and "Connect to load …" or "Connect to search" when nothing is saved. | See [Offline Support](/ui-kit/react/offline-support) for setup, the offline states and texts, events and customization. diff --git a/ui-kit/react/offline-support.mdx b/ui-kit/react/offline-support.mdx index 7afe3d798..2a2a1461d 100644 --- a/ui-kit/react/offline-support.mdx +++ b/ui-kit/react/offline-support.mdx @@ -370,7 +370,7 @@ Apps that don't call `setOfflineConfig()` get no offline UI, no offline events a - **Only what was loaded online is saved.** A user who has never opened a chat or list while online has nothing to show offline. - **Edits, deletes and reactions are not queued.** They need a connection when the user makes them. -- **Need a connection:** keyword search, message information, call logs and AI streamed replies. Call logs have no saved copy and keep their own error view. +- **Need a connection:** keyword search with no saved match, keyword search in the Search component, message information, call logs and AI streamed replies. Call logs have no saved copy and keep their own error view. - **Encryption in the browser** covers the cached content but not its lookup metadata, and downloaded media is stored unencrypted. See [Encrypt the Cache](/sdk/javascript/offline-encryption). ---