cometchat-react-v7-migration
Upgrade a React app from CometChat UI Kit v6 → v7 (`@cometchat/chat-uikit-react` ^6 → ^7). Reads the repo's CometChat usage, applies the breaking-change map (deps, symbol renames, RxJS events → `useCometChatEvents`, DataSource → plugins, templates → plugins, theme prop, calling), fetches the prop-by-prop guide, and verifies the build. Triggers: 'upgrade my v6 uikit to v7', 'migrate cometchat react v6 to v7', 'upgrade @cometchat/chat-uikit-react to v7', 'cometchat v6 to v7', 'bump cometchat uikit'.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- cometchat-react-v7-migration
- license
- MIT
- metadata
- { "tags": "cometchat react migration upgrade v6 v7 uikit", "author": "CometChat", "version": "1.0.0" }
- description
- Upgrade a React app from CometChat UI Kit v6 → v7 (`@cometchat/chat-uikit-react` ^6 → ^7). Reads the repo's CometChat usage, applies the breaking-change map (deps, symbol renames, RxJS events → `useCometChatEvents`, DataSource → plugins, templates → plugins, theme prop, calling), fetches the prop-by-prop guide, and verifies the build. Triggers: 'upgrade my v6 uikit to v7', 'migrate cometchat react v6 to v7', 'upgrade @cometchat/chat-uikit-react to v7', 'cometchat v6 to v7', 'bump cometchat uikit'.
- compatibility
- React >=18 <21; FROM @cometchat/chat-uikit-react ^6 → ^7 (7.2.x, verified 7.2.4); @cometchat/chat-sdk-javascript ^4.1.13 (peer); dompurify ^3.3.1 required (install explicitly); rxjs removed
02 资源文件 1
- 参考文档references/migration-guide.md13.0 KB
03 SKILL.md 正文
Ground truth: migrates a React app FROM
@cometchat/chat-uikit-react@6TO@7. v7 target symbols are catalog-verified vs installed 7.1.0; the v6→v7 breaking-change map is BAKED inreferences/migration-guide.md(distilled from the official migration docs + a real v6.5.4→v7.1.0 export diff). The exhaustive prop-by-prop table is FETCHED from the docs migration.mdtwins. APPEND/transform the user's code — never wipe it; work on a branch and confirm before bulk edits (RULES.md).
Companion skills (read first)
cometchat-react-v7-core— the v7 init/login/render +CometChatProviderthe migrated app lands on. This skill ASSUMES it.cometchat-react-v7-components— the v7 component catalog (the target names).
Use this skill when
"upgrade my v6 UI Kit to v7", "migrate CometChat React v6→v7", "bump @cometchat/chat-uikit-react to v7". Precondition: the project currently has @cometchat/chat-uikit-react@6.
Migration workflow (BAKED)
- Detect the starting point. Confirm
package.jsonhas@cometchat/chat-uikit-react@6(already@7→ STOP, nothing to migrate). Note the bundler (Vite/Next/CRA/React-Router/Astro → env prefix, percometchat-react-v7-patterns) and whether the app uses calls /rxjsevents /DataSource/ message templates. Work on a branch; transform in place, never delete the user's code. - Update dependencies.
npm install @cometchat/chat-uikit-react@7 @cometchat/chat-sdk-javascript@^4.1.13 dompurify@^3.3.1thennpm uninstall rxjs(v7 drops rxjs;dompurifyis required — the kit imports it at runtime; install it explicitly per the official docs, even though it's in the kit'sdependencies). If the app uses calling, bump the Calls SDK to the v7 major:npm install @cometchat/calls-sdk-javascript@5(v7 pins^5.x— verified; it is NOT the same major as the v6-era build). Enabling calling also moves: on the mandatedinitFromSettingspath useuiKit:{callsSDK:{}}(not the classicsetCallingEnabled(true)). - Scan the repo for v6 usage. Grep for the removed/renamed symbols + patterns from
references/migration-guide.md:CometChatDocumentBubble,CometChatCompactMessageComposer,CometChatUrlsFormatter,CometChatTextHighlightFormatter, any*Events(CometChatMessageEvents/CometChatGroupEvents/CometChatCallEvents/CometChatUserEvents/CometChatConversationEvents/CometChatUIEvents),DataSource/DataSourceDecorator/ChatConfigurator,CometChatMessageTemplate/templatesprop,textFormattersprop onCometChatMessageList/CometChatConversations(gone from the lists in v7 —textFormattersitself is NOT removed; see pitfalls),hideError/disableLoadingStateprops,data-themeattribute, localization (getLocalizedString(...),CometChatLocalize, unprefixed i18n keys likegroup_infothat v7 moved undersample_— §7),CometChatUIKitLoginListener, and the removed standalone components (CometChatEmojiKeyboard/CometChatMediaRecorder/CometChatToast/CometChatListItem/CometChatNotificationBadge). Produce the concrete change list. - Apply the breaking-change map (
references/migration-guide.md): symbol renames, RxJS*Events→ theuseCometChatEventshook,DataSource/ChatConfigurator→CometChatMessagePlugin+ thepluginsprop,templatesprop → plugins (textFormattersis NOT removed — relocate it, see pitfalls),data-theme→ thethemeprop, calling →uiKit:{callsSDK:{}}oninitFromSettings(step 2), localization → the v7 method + map v6 keys to the bundledsample_*keys (or register via the INSTANCE methodCometChatLocalize.getSharedInstance()?.addTranslation(...)— NOT a static) — seemigration-guide.md§7; look up the EXACT key in the uikit source (resources/<lang>/translation.json) / docs / GitHub, never guess. For any component's exact prop change NOT in the baked map, FETCH the prop-by-prop table viacometchat-react-v7-core/references/docs-map.md→migration-property-changes. - Wrap the chat tree in
CometChatProviderif it isn't already (v7 requires it above the components; init/login stay imperative and unchanged). - Verify. Build/typecheck passes; NO v6 symbols remain (grep the removed names); the app renders inside
CometChatProvider; migrated events/plugins/calling work. Reusecometchat-react-v7-core"Verify it works".
Common pitfalls (BAKED)
- Leftover
rxjsevent subscriptions — v6*Events.<x>.subscribe()do NOT fire in v7; convert every one touseCometChatEvents((event) => ...)(SDK + UI events share one bus). Publish viausePublishEvent(). - Forgetting
CometChatProvider— v7 components read it; symptom = context/"not initialized" errors even though init ran. CometChatMessageTemplate/templatesprops — removed from components; move custom message rendering to aCometChatMessagePluginpassed viaplugins.textFormattersis NOT removed — it stays a prop in v7 (verified vs 7.1.0) onCometChatMessageComposer, the bubble components (Text/Image/Video/Audio/File/...),CometChatSearchandCometChatMessageInformation, but it is GONE fromCometChatMessageList/CometChatConversations. Keep it as a prop on those components. The list's bubbles take formatters from the text plugin'sgetTextFormatters(), so to keep a v6 list-level formatter, override that one method —plugins={[{ ...CometChatTextPlugin, getTextFormatters: () => [/* defaults + yours */] }]}(provider plugins precede the defaults, so it wins).- Dependency drift — missing the new
dompurifypeer dep, or leftoverrxjs, breaks the build; do both halves of step 2. - Calling silently off — v7 needs calling turned on in the init settings (
uiKit: { callsSDK: {} }viaCometChatUIKit.initFromSettings; or the classic.setCallingEnabled(true)onUIKitSettingsBuilder) — not a provider prop; without it, call buttons hide and the Calls SDK never loads. - Bubble routing — the message list now defaults to the multi-attachment bubbles (
CometChatImageBubble→CometChatImagesBubble, singularCometChatFileBubblestill ships); code that imported singular bubble names for the list default may need the plural. - Don't mass-remove
hideError— it's removed from list components but retained onCometChatMessageComposer;textFormatterslikewise still exists on the message-bubble components. Scope the removals; don't blanket-strip.
Verify it works
Build/typecheck is green; a repo-wide grep finds NO removed v6 symbols (CometChatDocumentBubble, CometChatCompactMessageComposer, *Events, DataSource, DataSourceDecorator, ChatConfigurator, CometChatMessageTemplate, CometChatUIKitLoginListener); the app renders inside CometChatProvider; and any migrated events / plugins / calling work. Full prop-by-prop reference: fetch migration-property-changes via cometchat-react-v7-core/references/docs-map.md.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.