Repository navigation
docs(offline): Offline Support for the React Native SDK and React Native UI Kit - #567
Draft
raj-dubey1 wants to merge 4 commits into
Draft
raj-dubey1 wants to merge 4 commits into
raj-dubey1 wants to merge 4 commits into
Conversation
…ive UI Kit Add an Offline Support page under each product's messaging/core features: - sdk/react-native/offline-support (Messaging group) - ui-kit/react-native/offline-support (Features > Chat, after Core) Add an Offline Support section to the React Native core-features page and list the pages in the llms indexes. The existing /ui-kit/react-native/5.0/:slug* wildcard redirect already covers the new UI Kit page. Content is limited to what is common to the Android, iOS, Flutter, JavaScript and React Native offline SDK lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
- RN UI Kit: note that the kit applies `offline` only when the installed SDK exposes CometChat.OfflineConfig (CometChatUIKit.ts:65), so an older SDK silently ignores it; a plain object turns offline on unless it sets enabled: false (OfflineConfig.fromJson). - RN SDK: the AI quick reference is now a table, like the other pages. - RN SDK: TypeScript/JavaScript tabs on every code snippet. - RN SDK: onCachedConversation is called with undefined when the conversation is not cached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RN SDK page: - Requirements: op-sqlite >=9.0.0 (required), react-native-fs, react-native-keychain, React Native 0.74+, rebuild after install, Expo dev build / EAS (no Expo Go). - Config table: all 14 OfflineConfig keys with defaults and ranges from OfflineConfig.ts, including encryptionFailureBehavior. - enabled: always set explicitly; wording stays correct once the object-form default is fixed. - New "Failed Messages and Retry": when a message becomes FAILED, that the SDK never retries it, retryMessage / retryAllFailedMessages (TRANSIENT only), and a robust way to read the local id. - New "Other Offline Methods" reference: forceSyncNow, getSyncState, getLastSyncTimestamp, getCacheSize, clearOfflineCache, downloadMedia, getCachedMediaPath, getMediaCaching, addOfflineMessageListener. - Encryption: native rebuild, Expo prebuild note, status example, encryptionFailureBehavior. - Minimum SDK version placeholder (TODO). RN UI Kit page: - NetInfo is a required install; op-sqlite / fs / keychain with versions. - Options object: always include enabled: true; initFromSettings via chatSDK.offline. - Pending (clock) and failed (error) indicators in the message list and conversation rows. - Minimum UI Kit / SDK version placeholder (TODO). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…403) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WEaVigCRBjkftm78T25MQA
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds Offline Support docs for the React Native SDK (v4) and React Native UI Kit (v5). The JavaScript SDK, React and Angular docs are in a separate PR (#566).
Files
sdk/react-native/offline-support.mdxreact-native-fs,react-native-keychain, React Native 0.74+, Expo dev build / EAS, no Expo Go), enable withCometChat.OfflineConfig, all 14 config options,isOfflineEnabled, two-phase reads, queued sends (queued vs failed), pending messages, failure reasons and retry, sync listener, other offline methods (reference table), encryption (SQLCipher,react-native-keychain,setOfflineKeyVault,encryptionFailureBehavior), cache resets, login / logout, limitationsui-kit/react-native/offline-support.mdxofflinefield onUIKitSettingsandchatSDK.offlineforinitFromSettings, what changes in the components (incl. pending / failed indicators)ui-kit/react-native/core-features.mdxdocs.json/ui-kit/react-native/5.0/:slug*wildcard already covers the new page, and SDK pages get no redirects when they are newsdk/react-native/llms-react-native-v4.mdx,ui-kit/react-native/llms-react-native-v5.mdxVerified against source
rajdubey/eng-40403-offlinern-sdk-parity-with-android-sdk-production-ready-fixes@a935639f(CHANGELOG.md4.2.0 entry,docs/offline/SETUP.md,docs/offline/ANDROID_PARITY.md,src/lib/offline/**,src/lib/CometChat.ts,dist/CometChat.d.ts). Earlier revisions were checked against PR Updated Integration Guide #440 head18460a41.OFFLINE_CONFIG_DEFAULTS(enabled: false, also in thefromJson/ settings-file object form),normalizeCountranges,maxSnapshotQueries/snapshotTtlDays<= 0→ default.prefetch*keys are removed in 4.2.0 and not documented.onMessagePending(statusPENDING,getLocalMessageId()set), then oneonError(error, null)witherrorParams.queued === true, codeFAILED_TO_FETCH; the Promise rejects with it (OfflineErrors.queuedNotConnectedError,OfflineSends.sendMessage). TheERROR_OFFLINE_MESSAGE_QUEUEDtext is gone.Outbox.ts,FailureClassifier.ts): 5xx / 429 and the 5-reconnect no-answer cap (ERROR_OUTBOX_AUTO_FLUSH_CAP_REACHED) →TRANSIENT; other rejections →PERMANENT; admission →ERROR_PENDING_QUEUE_LIMITwithQUEUE_FULL/QUEUE_OVERFLOW/BYTE_OVERFLOW;clearOfflineCache()/ conversation purge →DISCARDED.retryMessageacceptsFAILEDonly (ERROR_OFFLINE_MESSAGE_NOT_RETRYABLEotherwise);retryAllFailedMessagesretriesTRANSIENTonly; nothing auto-retriesFAILED. The cap countsPENDING+SENDING, notFAILED. Send answer timeout 15 s / 120 s media.getMediaCachingMode()(getMediaCaching()deprecated,OFFwhile offline is inactive);getLastSyncTimestamp()server seconds;getCacheSize()includes media;forceSyncNowcooldown 10 s (FORCE_SYNC_COOLDOWN_MS);onMessageSyncCompleted(messages, outcome);addOfflineCacheResetListener+OfflineCacheResetReason;setOfflineKeyVault(public, documented in the SDK's own setup notes;OfflineKeyStoreremoved);getOfflineEncryptionStatus()cipher= SQLCipher version,leakagealways set.b0d236f, plus the companion 4.2.0 compatibility change in progress (removes the automatic retry ofFAILEDmessages, treatsDISCARDEDas final, usesgetMediaCachingMode(), treats a queued send as pending).packages/ChatUiKit/package.jsonon the PR branch is still5.5.1, so the UI Kit version stays TODO.UIKitSettings.offline?: boolean | object;CometChatUIKit.initpasses it throughOfflineConfig.fromJson;initFromSettingspasseschatSDK.offlineto the SDK.CometChatMessageList.tsximports@react-native-community/netinfoat the top level (the bundle fails without it). Pending / failed indicators:MessageUtils.tsxandCometChatConversations.tsx(WAIT/ERRORreceipts).getPendingMessages()shows PENDING,onMessageSentonce on reconnect; SQLCipher build →getOfflineEncryptionStatus()reportsatRest: "SQLCIPHER". The 4.2.0 send-notice change has not been re-run on a device.Release blockers and points for reviewers
Versions to fill in: the minimum RN UI Kit version (TODO comment on the UI Kit page). The RN SDK version is 4.2.0.
Resolved by SDK 4.2.0 (the pages now document the fixed behaviour):
onMessagePendingstatus /getLocalMessageId();fromJsonenableddefault; queued sends now notify throughonError(noMESSAGE_QUEUED);getMediaCachingMode();DISCARDEDreason and callbacks onclearOfflineCache();OfflineKeyStoreremoved (setOfflineKeyVaultdocumented);SyncOutcomeat runtime;maxSnapshotQueries/snapshotTtlDays0handling.Still open:
FAILEDmessages on reconnect (now thatlocalMessageIdis set andFAILEDis retryable, the NetInfo backstop inCometChatMessageListwould auto-resend failed messages), treatDISCARDEDas final, switch togetMediaCachingMode(), and keep a queued send (errorParams.queued) as pending. The UI Kit page already describes that behaviour.@react-native-community/netinfowithout declaring it, so any app upgrading the kit fails to bundle, even with offline off (the page lists it as required).PERMANENT(MessageFailureReason.PERMANENT,OfflineErrorCode.AUTO_FLUSH_CAP_REACHED); the code and CHANGELOG sayTRANSIENT, and the docs follow the code.ERROR_PENDING_QUEUE_LIMITis not exposed onCometChat.OfflineErrorCode, so the docs use the string.Decision for the author: the original scope rule (document only what all five SDKs share) left out retry,
forceSyncNow,clearOfflineCache,getSyncState,getLastSyncTimestamp,getCacheSizeand the media APIs because they are stubs on iOS. This revision documents them on the RN page because they exist and work in the RN SDK. Revert those sections if the cross-platform rule should win.Checks
docs.jsonparses, and every new nav entry resolves to a file.review-docs-pranalyzer (--scope sdk/react-native/and--scope ui-kit/react-native/): no missing redirects, no unresolved nav refs, no broken links in the PR's files (3 pre-existing broken links in untouched RN SDK pages; thellms-*files are intentionally outside the nav).@mdx-js/mdx3 + GFM.npx mint broken-links(as of 5bedd98) now stops at the pre-existing parse error inui-kit/react/integration-astro.mdx, which this PR doesn't touch; it stops the same way on d705439 today (an earlier mint run on d705439 reported "no broken links found").Type of Change
🤖 Generated with Claude Code