refactor(client): drop residual Accounts.* usages from 3 client files#40480
Conversation
Three small follow-ups to the Meteor → SDK migration that don't fit any
larger cluster:
- CachedStore.getToken() reads the stored login token via getStoredItem from
the SDK storage helper instead of Accounts._storedLoginToken(); the
meteor/accounts-base import is no longer needed in this file.
- Define a local LoginCancelledError class with the same numericError
(0x8acdc2f) and Error shape as Meteor's Accounts.LoginCancelledError. The
OAuth login flow checks Meteor.Error.error against that numericError to
detect server-issued cancellations, so the constant has to match. Replace
the 3 Accounts.LoginCancelledError references in oauth.ts with the new
class.
- Replace Accounts.verifyEmail(token, callback) with sdk.call('verifyEmail',
token) wrapped in async/await. Register the method on @rocket.chat/ddp-client
via module augmentation since verifyEmail is a Meteor built-in
(accounts-password) and isn't otherwise typed. Drops the
meteor/accounts-base import from startup/accounts.ts.
No behaviour change.
|
Looks like this PR is ready to merge! 🎉 |
|
WalkthroughThis PR decouples the client from Meteor's Accounts module by introducing a custom ChangesMeteor Accounts Decoupling
Sequence Diagram(s)sequenceDiagram
participant Client
participant DdpSdk as DdpSdk
participant Server
participant MainApp as MainApp
participant UI
Client->>DdpSdk: onEmailVerificationLink(token)
DdpSdk->>Server: call('verifyEmail', token)
Server-->>DdpSdk: verification result
DdpSdk-->>Client: result
Client->>MainApp: whenMainReady()
Client->>UI: afterVerifyEmail / show success or error toast
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/meteor/client/meteor/startup/accounts.ts (1)
5-9: ⚡ Quick winRemove inline implementation comments in this TS file.
Please drop the explanatory comments (including the eslint-disable comment) here and keep only the augmentation code itself.
As per coding guidelines: “
**/*.{ts,tsx,js}: … Avoid code comments in the implementation”.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/meteor/client/meteor/startup/accounts.ts` around lines 5 - 9, Remove the inline explanatory comments and the eslint-disable comment from the TypeScript module augmentation so only the augmentation remains; specifically edit the declare module '@rocket.chat/ddp-client' block and its interface ServerMethods to keep only the TypeScript declarations (no comments or eslint directives) while leaving the declaration code intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/meteor/client/meteor/login/LoginCancelledError.ts`:
- Around line 1-3: Remove the top-of-file implementation comment block (the
three comment lines preceding the code) so the file conforms to the repo TS
guideline; leave the exported LoginCancelledError symbol and its implementation
unchanged (i.e., delete the comment that says it mirrors Meteor's
Accounts.LoginCancelledError but do not modify the LoginCancelledError class or
its export).
In `@apps/meteor/client/meteor/startup/accounts.ts`:
- Around line 59-61: The toast is currently passing the raw caught value (error)
to dispatchToastMessage which can be an object; normalize it into a
user-friendly string first (e.g., const msg = error?.message || String(error ||
'An error occurred')) and then call dispatchToastMessage({ type: 'error',
message: msg }); update the code in the block that runs after await
whenMainReady() where dispatchToastMessage(...) is called (and keep the existing
throw new Meteor.Error('verify-email', 'E-mail not verified') behavior).
---
Nitpick comments:
In `@apps/meteor/client/meteor/startup/accounts.ts`:
- Around line 5-9: Remove the inline explanatory comments and the eslint-disable
comment from the TypeScript module augmentation so only the augmentation
remains; specifically edit the declare module '@rocket.chat/ddp-client' block
and its interface ServerMethods to keep only the TypeScript declarations (no
comments or eslint directives) while leaving the declaration code intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 51d3e5d7-430d-4c65-85cc-ec602c8a9bc5
📒 Files selected for processing (4)
apps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/meteor/login/LoginCancelledError.tsapps/meteor/client/meteor/login/oauth.tsapps/meteor/client/meteor/startup/accounts.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/meteor/login/LoginCancelledError.tsapps/meteor/client/meteor/startup/accounts.tsapps/meteor/client/meteor/login/oauth.tsapps/meteor/client/lib/cachedStores/CachedStore.ts
🧠 Learnings (4)
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Applied to files:
apps/meteor/client/meteor/login/LoginCancelledError.tsapps/meteor/client/meteor/startup/accounts.tsapps/meteor/client/meteor/login/oauth.tsapps/meteor/client/lib/cachedStores/CachedStore.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/client/meteor/login/LoginCancelledError.tsapps/meteor/client/meteor/startup/accounts.tsapps/meteor/client/meteor/login/oauth.tsapps/meteor/client/lib/cachedStores/CachedStore.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/client/meteor/login/LoginCancelledError.tsapps/meteor/client/meteor/startup/accounts.tsapps/meteor/client/meteor/login/oauth.tsapps/meteor/client/lib/cachedStores/CachedStore.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/meteor/login/LoginCancelledError.tsapps/meteor/client/meteor/startup/accounts.tsapps/meteor/client/meteor/login/oauth.tsapps/meteor/client/lib/cachedStores/CachedStore.ts
🔇 Additional comments (4)
apps/meteor/client/lib/cachedStores/CachedStore.ts (2)
16-16: Import migration looks correct.This switch cleanly centralizes token access through the SDK storage helper and supports the Accounts decoupling goal.
383-385: Token source change ingetToken()is sound.Using
STORAGE_KEYS.LOGIN_TOKENhere preserves the existing cache token guard behavior while removing the residualAccounts.*dependency.apps/meteor/client/meteor/login/LoginCancelledError.ts (1)
4-11: Error-shape compatibility looks good.
numericError,name, and constructor behavior preserve cancellation mapping as intended.apps/meteor/client/meteor/login/oauth.ts (1)
5-5: Cancellation conversion refactor is clean and type-safe.The
LoginCancelledErrorguard + return type update is consistent and preserves prior behavior withoutAccounts.LoginCancelledErrorcoupling.Also applies to: 11-11, 13-13, 15-15
| await whenMainReady(); | ||
| dispatchToastMessage({ type: 'error', message: error }); | ||
| throw new Meteor.Error('verify-email', 'E-mail not verified'); |
There was a problem hiding this comment.
Normalize caught errors before sending toast message.
message: error can surface non-user-friendly output when the thrown value is an object. Convert it to a string message before dispatching the toast.
Proposed fix
} catch (error) {
await whenMainReady();
- dispatchToastMessage({ type: 'error', message: error });
+ const message =
+ error instanceof Meteor.Error
+ ? error.reason || error.message
+ : error instanceof Error
+ ? error.message
+ : t('E-mail_not_verified');
+ dispatchToastMessage({ type: 'error', message });
throw new Meteor.Error('verify-email', 'E-mail not verified');
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| await whenMainReady(); | |
| dispatchToastMessage({ type: 'error', message: error }); | |
| throw new Meteor.Error('verify-email', 'E-mail not verified'); | |
| } catch (error) { | |
| await whenMainReady(); | |
| const message = | |
| error instanceof Meteor.Error | |
| ? error.reason || error.message | |
| : error instanceof Error | |
| ? error.message | |
| : t('E-mail_not_verified'); | |
| dispatchToastMessage({ type: 'error', message }); | |
| throw new Meteor.Error('verify-email', 'E-mail not verified'); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/meteor/client/meteor/startup/accounts.ts` around lines 59 - 61, The
toast is currently passing the raw caught value (error) to dispatchToastMessage
which can be an object; normalize it into a user-friendly string first (e.g.,
const msg = error?.message || String(error || 'An error occurred')) and then
call dispatchToastMessage({ type: 'error', message: msg }); update the code in
the block that runs after await whenMainReady() where dispatchToastMessage(...)
is called (and keep the existing throw new Meteor.Error('verify-email', 'E-mail
not verified') behavior).
There was a problem hiding this comment.
dispatchToastMessage implementation was built for handling error objects whenever type is 'error'.
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
ast-grep --pattern 'const dispatchToastMessage = $_'
rg -n "dispatchToastMessage" --type=ts -C5 -g "!*.test.*" -g "!*.spec.*" | grep -A10 "type.*error\|error.*type\|message.*error" | head -60
fd "toast" --type=f -e ts | head -20
Length of output: 37850
🏁 Script executed:
#!/bin/bash
cat apps/meteor/client/lib/toast.ts
echo "---"
cat packages/ui-contexts/src/ToastMessagesContext.ts
Length of output: 1232
@tassoevan, you're absolutely right — the type definition confirms it. The ToastMessagePayload for type: 'error' explicitly declares message: unknown, meaning dispatchToastMessage is intentionally designed to accept raw error objects in the error case. My suggestion to normalize the error was unnecessary. Apologies for the noise!
✏️ Learnings added
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In RocketChat/Rocket.Chat, `dispatchToastMessage` (defined in `apps/meteor/client/lib/toast.ts`) accepts `message: unknown` when `type` is `'error'`, so it intentionally handles raw error objects directly. Do not suggest normalizing caught errors before passing them to `dispatchToastMessage({ type: 'error', message: error })` — no manual conversion to string or `error.message` extraction is needed.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #40480 +/- ##
===========================================
- Coverage 69.63% 69.59% -0.05%
===========================================
Files 3318 3321 +3
Lines 121981 122507 +526
Branches 21813 21876 +63
===========================================
+ Hits 84947 85259 +312
- Misses 33701 33924 +223
+ Partials 3333 3324 -9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Co-authored-by: Tasso Evangelista <[email protected]>
- Move all imports above the `declare module` block in meteor/startup/accounts.ts (import/order + import/first). - Add the blank line lines-between-class-members expects between numericError and the override name field on LoginCancelledError.
|
/jira ARCH-2116 |
…40445) Co-authored-by: Tasso Evangelista <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/sdk-tracker-easy-autoruns.md:
- Line 5: The changeset text incorrectly claims the bridge subscribes to
'connected' when the implementation in meteorBackedSdk (the connection-status
bridge that attaches to Meteor.connection._stream) deliberately only registers
'reset' and 'disconnect' because stream.on('connected', …) is invalid; update
the changeset wording to list only 'reset' and 'disconnect' (and/or explicitly
state that 'connected' is omitted and why) so it matches the implementation and
prevents future maintainers from re-adding a 'connected' listener.
In `@apps/meteor/client/lib/cachedStores/CachedStore.ts`:
- Around line 317-329: The reconnection listener stored in
reconnectionUnsubscribe is not being removed when the store is released,
allowing trySync() to be called after teardown; in the release() method
(alongside where listenerUnsubscriber is cleaned up) call
reconnectionUnsubscribe?.() and set reconnectionUnsubscribe = undefined (and do
the same cleanup wherever release logic exists, e.g., the other release path
referenced around the second occurrence) so the on('connection') handler is
unsubscribed and cannot trigger trySync() after release.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a549c9cc-65a4-43f2-877e-f092da07ad61
📒 Files selected for processing (12)
.changeset/sdk-tracker-easy-autoruns.mdapps/meteor/app/ui-message/client/messageBox/createComposerAPI.tsapps/meteor/app/utils/client/lib/SDKClient.tsapps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/lib/sdk/ddpSdk.tsapps/meteor/client/lib/sdk/meteorBackedSdk.tsapps/meteor/client/lib/streamer/streamer.tsapps/meteor/client/meteor/overrides/killMeteorStream.tsapps/meteor/client/meteor/overrides/stubMeteorStream.tsapps/meteor/client/meteor/overrides/subscribeViaSDK.tsapps/meteor/client/providers/AuthenticationProvider/AuthenticationProvider.tsxapps/meteor/definition/externals/meteor/meteor.d.ts
✅ Files skipped from review due to trivial changes (1)
- apps/meteor/client/providers/AuthenticationProvider/AuthenticationProvider.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/meteor/overrides/killMeteorStream.tsapps/meteor/client/lib/sdk/ddpSdk.tsapps/meteor/client/meteor/overrides/subscribeViaSDK.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.tsapps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/lib/streamer/streamer.tsapps/meteor/definition/externals/meteor/meteor.d.tsapps/meteor/client/lib/sdk/meteorBackedSdk.tsapps/meteor/app/utils/client/lib/SDKClient.tsapps/meteor/client/meteor/overrides/stubMeteorStream.ts
🧠 Learnings (6)
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Applied to files:
apps/meteor/client/meteor/overrides/killMeteorStream.tsapps/meteor/client/lib/sdk/ddpSdk.tsapps/meteor/client/meteor/overrides/subscribeViaSDK.tsapps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/lib/streamer/streamer.tsapps/meteor/client/lib/sdk/meteorBackedSdk.tsapps/meteor/client/meteor/overrides/stubMeteorStream.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.
Applied to files:
apps/meteor/client/meteor/overrides/killMeteorStream.tsapps/meteor/client/lib/sdk/ddpSdk.tsapps/meteor/client/meteor/overrides/subscribeViaSDK.tsapps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/lib/streamer/streamer.tsapps/meteor/client/lib/sdk/meteorBackedSdk.tsapps/meteor/client/meteor/overrides/stubMeteorStream.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/client/meteor/overrides/killMeteorStream.tsapps/meteor/client/lib/sdk/ddpSdk.tsapps/meteor/client/meteor/overrides/subscribeViaSDK.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.tsapps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/lib/streamer/streamer.tsapps/meteor/definition/externals/meteor/meteor.d.tsapps/meteor/client/lib/sdk/meteorBackedSdk.tsapps/meteor/app/utils/client/lib/SDKClient.tsapps/meteor/client/meteor/overrides/stubMeteorStream.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/client/meteor/overrides/killMeteorStream.tsapps/meteor/client/lib/sdk/ddpSdk.tsapps/meteor/client/meteor/overrides/subscribeViaSDK.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.tsapps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/lib/streamer/streamer.tsapps/meteor/definition/externals/meteor/meteor.d.tsapps/meteor/client/lib/sdk/meteorBackedSdk.tsapps/meteor/app/utils/client/lib/SDKClient.tsapps/meteor/client/meteor/overrides/stubMeteorStream.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/meteor/overrides/killMeteorStream.tsapps/meteor/client/lib/sdk/ddpSdk.tsapps/meteor/client/meteor/overrides/subscribeViaSDK.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.tsapps/meteor/client/lib/cachedStores/CachedStore.tsapps/meteor/client/lib/streamer/streamer.tsapps/meteor/definition/externals/meteor/meteor.d.tsapps/meteor/client/lib/sdk/meteorBackedSdk.tsapps/meteor/app/utils/client/lib/SDKClient.tsapps/meteor/client/meteor/overrides/stubMeteorStream.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.
Applied to files:
.changeset/sdk-tracker-easy-autoruns.md
🔇 Additional comments (10)
apps/meteor/client/lib/cachedStores/CachedStore.ts (1)
15-15: LGTM!Also applies to: 382-383
apps/meteor/app/utils/client/lib/SDKClient.ts (1)
201-201: LGTM!Also applies to: 269-269, 302-303
apps/meteor/client/lib/streamer/streamer.ts (1)
24-31: LGTM!Also applies to: 51-51, 80-80, 112-112
apps/meteor/client/meteor/overrides/killMeteorStream.ts (1)
33-33: LGTM!apps/meteor/client/meteor/overrides/stubMeteorStream.ts (1)
34-34: LGTM!Also applies to: 36-36, 51-51, 53-53, 55-55, 64-64, 71-71
apps/meteor/client/meteor/overrides/subscribeViaSDK.ts (1)
48-48: LGTM!Also applies to: 64-64
apps/meteor/client/lib/sdk/ddpSdk.ts (1)
146-146: LGTM!apps/meteor/definition/externals/meteor/meteor.d.ts (1)
67-102: LGTM!Also applies to: 110-114, 117-117, 148-148
apps/meteor/client/lib/sdk/meteorBackedSdk.ts (1)
29-57: LGTM!Also applies to: 78-87, 111-111
apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts (1)
10-10: LGTM!Also applies to: 198-217, 222-222
| this.reconnectionUnsubscribe?.(); | ||
| const sdk = getDdpSdk(); | ||
| let wentOffline = sdk.connection.status !== 'connected'; | ||
| this.reconnectionUnsubscribe = sdk.connection.on('connection', () => { | ||
| if (sdk.connection.status !== 'connected') { | ||
| wentOffline = true; | ||
| return; | ||
| } | ||
|
|
||
| if (status === 'connected' && wentOffline) { | ||
| if (wentOffline) { | ||
| wentOffline = false; | ||
| this.trySync(); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Unsubscribe the reconnection handler during release.
This listener survives release(), so logout can still leave the private store reacting to later connection changes and calling trySync() after it was torn down. Please clean up reconnectionUnsubscribe alongside listenerUnsubscriber.
Proposed fix
async release() {
if (this.initializationPromise) {
await this.initializationPromise;
}
this.listenerUnsubscriber?.();
+ this.reconnectionUnsubscribe?.();
+ this.reconnectionUnsubscribe = undefined;
this.setReady(false);
}Also applies to: 364-364
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/meteor/client/lib/cachedStores/CachedStore.ts` around lines 317 - 329,
The reconnection listener stored in reconnectionUnsubscribe is not being removed
when the store is released, allowing trySync() to be called after teardown; in
the release() method (alongside where listenerUnsubscriber is cleaned up) call
reconnectionUnsubscribe?.() and set reconnectionUnsubscribe = undefined (and do
the same cleanup wherever release logic exists, e.g., the other release path
referenced around the second occurrence) so the on('connection') handler is
unsubscribed and cannot trigger trySync() after release.
Summary
Three small follow-ups to the Meteor → SDK migration that don't fit any larger cluster:
CachedStore.getToken()reads the stored login token viagetStoredItem(STORAGE_KEYS.LOGIN_TOKEN)from the SDK storage helper (added in refactor(client): replace Accounts.storageLocation with SDK storage helper #40479) instead ofAccounts._storedLoginToken(). Themeteor/accounts-baseimport is no longer needed in this file.LoginCancelledErrorclass atapps/meteor/client/meteor/login/LoginCancelledError.tswith the samenumericError(0x8acdc2f) andError-subclass shape as Meteor'sAccounts.LoginCancelledError. The OAuth login flow checksMeteor.Error.error === LoginCancelledError.numericErrorto detect server-issued cancellations, so the constant has to match. Replace the 3Accounts.LoginCancelledErrorreferences inoauth.tswith the new class.Accounts.verifyEmailinmeteor/startup/accounts.tsbecomesawait sdk.call('verifyEmail', token)wrapped inasync/awaitwith the same error-toast flow. RegisterverifyEmailon@rocket.chat/ddp-client'sServerMethodsvia module augmentation since it's a Meteor built-in (accounts-password) and isn't otherwise typed. Drops themeteor/accounts-baseimport from this file.No behaviour change.
Test plan
tsc --noEmitonapps/meteoris clean (no regressions in the changed files)yarn eslinton the 4 changed files: 0 errorsCachedStore.getToken()still returns the stored token./verify-email/<token>); on success the toast appears andafterVerifyEmailserver method fires; on a bad token the error toast appears.Summary by CodeRabbit
Task: ARCH-2134