regression: login hangs on loading when "Forget User Session on Window Close" is enabled#40676
regression: login hangs on loading when "Forget User Session on Window Close" is enabled#40676cardoso wants to merge 10 commits into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughClient storage now supports switching between localStorage and sessionStorage with migration of login keys; Meteor Accounts is configured to match the selected backend on startup and when the setting changes. Server-side injected migration was removed and E2E tests updated to assert session persistence when the setting is enabled. ChangesSession Storage Backend and Accounts Configuration
Server Cleanup and Test Validation
Sequence Diagram(s)sequenceDiagram
participant ClientStartup as Client Startup
participant PublicSetting as PublicSettingsCachedStore
participant setStorageBackend as setStorageBackend()
participant moveLoginKeys as moveLoginKeys()
participant Storage as localStorage/sessionStorage
participant AccountsConfig as Accounts.config()
ClientStartup->>PublicSetting: read Accounts_ForgetUserSessionOnWindowClose
PublicSetting-->>ClientStartup: desired backend ('session'|'local')
ClientStartup->>setStorageBackend: request backend change
setStorageBackend->>moveLoginKeys: migrate login keys
moveLoginKeys->>Storage: read keys from source storage
moveLoginKeys->>Storage: write keys to target storage
moveLoginKeys->>Storage: remove keys from source storage
setStorageBackend->>AccountsConfig: ensure Accounts configured with backend
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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)
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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-8.5.0 #40676 +/- ##
================================================
Coverage ? 69.90%
================================================
Files ? 3327
Lines ? 126722
Branches ? 22007
================================================
Hits ? 88580
Misses ? 34851
Partials ? 3291
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
2 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/client/lib/sdk/storage.ts">
<violation number="1" location="apps/meteor/client/lib/sdk/storage.ts:58">
P1: `moveLoginKeys` performs unguarded `localStorage`/`sessionStorage` reads and writes, which can throw and break startup login flow. Wrap migration access in a `try/catch` (consistent with `getStorage`) so unavailable storage does not crash initialization.</violation>
</file>
<file name="apps/meteor/client/meteor/startup/accounts.ts">
<violation number="1" location="apps/meteor/client/meteor/startup/accounts.ts:73">
P1: `Accounts.config({ clientStorage })` is invoked from reactive subscriptions, so toggling the setting can reconfigure Accounts at runtime and trigger Meteor’s “Can’t set … more than once” error.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts (1)
22-22: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winReplace
page.locator('role=...')with semantic locators.The tests use
page.locator('role=heading[name="Welcome to Rocket.Chat"]')instead of the preferred semantic locatorpage.getByRole(). As per coding guidelines, always prefer semantic locators likepage.getByRole(),page.getByLabel(),page.getByText(), orpage.getByTitle()overpage.locator()in Playwright tests.♻️ Proposed fix
Replace all instances of:
-await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible(); +await expect(page.getByRole('heading', { name: 'Welcome to Rocket.Chat' })).toBeVisible();And:
-await expect(newPage.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible(); +await expect(newPage.getByRole('heading', { name: 'Welcome to Rocket.Chat' })).toBeVisible();Apply this pattern to lines 22, 27, 43, 47, 53, and 61.
As per coding guidelines: Avoid using
page.locator()in Playwright tests - always prefer semantic locators.Also applies to: 27-27, 43-43, 47-47, 53-53, 61-61
🤖 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/tests/e2e/account-forgetSessionOnWindowClose.spec.ts` at line 22, Replace the non-semantic Playwright locators that use the "role=..." string with semantic locators: change any usage of page.locator that targets a role to page.getByRole and supply the role (e.g., "heading") and the name option ("Welcome to Rocket.Chat"); apply the same pattern for the other occurrences flagged (replace role-based page.locator calls with the appropriate semantic getByRole/getByLabel/getByText/getByTitle variants) so all role locators become semantic locators.
🤖 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/lib/sdk/storage.ts`:
- Around line 44-69: moveLoginKeys currently dereferences
window.localStorage/sessionStorage directly and can throw; update it to use the
same guarded access as getStorage(): obtain source and target via the safe
accessor (or replicate its checks) so that if Web Storage is unavailable you
treat it as a no-op, and wrap setItem/getItem/removeItem operations in try/catch
to avoid throwing and leaving setStorageBackend half-applied; reference
moveLoginKeys, getStorage, setStorageBackend and STORAGE_KEYS when locating and
modifying the code.
---
Outside diff comments:
In `@apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts`:
- Line 22: Replace the non-semantic Playwright locators that use the "role=..."
string with semantic locators: change any usage of page.locator that targets a
role to page.getByRole and supply the role (e.g., "heading") and the name option
("Welcome to Rocket.Chat"); apply the same pattern for the other occurrences
flagged (replace role-based page.locator calls with the appropriate semantic
getByRole/getByLabel/getByText/getByTitle variants) so all role locators become
semantic locators.
🪄 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: a4ec1a5b-1b6f-40b9-b3d9-98fe8a66b6e6
📒 Files selected for processing (4)
apps/meteor/app/ui-master/server/scripts.tsapps/meteor/client/lib/sdk/storage.tsapps/meteor/client/meteor/startup/accounts.tsapps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.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). (2)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{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/tests/e2e/account-forgetSessionOnWindowClose.spec.tsapps/meteor/client/lib/sdk/storage.tsapps/meteor/app/ui-master/server/scripts.tsapps/meteor/client/meteor/startup/accounts.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created inapps/meteor/tests/e2e/directory
Avoid usingpage.locator()in Playwright tests - always prefer semantic locators such aspage.getByRole(),page.getByLabel(),page.getByText(), orpage.getByTitle()
Usetest.beforeAll()andtest.afterAll()for setup/teardown in Playwright tests
Usetest.step()for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test,page,expect) for consistency in test files
Prefer web-first assertions (toBeVisible,toHaveText, etc.) in Playwright tests
Useexpectmatchers for assertions (toEqual,toContain,toBeTruthy,toHaveLength, etc.) instead ofassertstatements in Playwright tests
Usepage.waitFor()with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts
Files:
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests
Files:
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts
🧠 Learnings (8)
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.
Applied to files:
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.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/tests/e2e/account-forgetSessionOnWindowClose.spec.tsapps/meteor/client/lib/sdk/storage.tsapps/meteor/app/ui-master/server/scripts.tsapps/meteor/client/meteor/startup/accounts.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/tests/e2e/account-forgetSessionOnWindowClose.spec.tsapps/meteor/client/lib/sdk/storage.tsapps/meteor/app/ui-master/server/scripts.tsapps/meteor/client/meteor/startup/accounts.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.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/tests/e2e/account-forgetSessionOnWindowClose.spec.tsapps/meteor/client/lib/sdk/storage.tsapps/meteor/app/ui-master/server/scripts.tsapps/meteor/client/meteor/startup/accounts.ts
📚 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/lib/sdk/storage.tsapps/meteor/client/meteor/startup/accounts.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/lib/sdk/storage.tsapps/meteor/client/meteor/startup/accounts.ts
🧬 Code graph analysis (4)
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts (2)
apps/meteor/tests/e2e/page-objects/auth.ts (1)
Login(48-76)apps/meteor/tests/e2e/utils/test.ts (1)
test(134-134)
apps/meteor/client/lib/sdk/storage.ts (2)
apps/meteor/client/lib/sdk/ddpSdk.ts (2)
ensureConnectedAndAuthenticated(75-154)readStoredLoginToken(71-71)apps/meteor/client/meteor/startup/accounts.ts (1)
applyForgetSessionOnWindowClose(65-75)
apps/meteor/app/ui-master/server/scripts.ts (1)
apps/meteor/app/ui-master/server/inject.ts (1)
addScript(78-94)
apps/meteor/client/meteor/startup/accounts.ts (1)
apps/meteor/client/lib/sdk/storage.ts (1)
setStorageBackend(39-42)
🔇 Additional comments (4)
apps/meteor/app/ui-master/server/scripts.ts (1)
37-40: LGTM!apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.ts (2)
40-48: LGTM!
50-62: LGTM!apps/meteor/client/meteor/startup/accounts.ts (1)
1-8: LGTM!Also applies to: 53-80
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/meteor/client/lib/sdk/storage.ts (1)
2-3: 💤 Low valueModule comment references only localStorage but code now supports sessionStorage.
The header comment states reads/writes use
window.localStorageunder the hood, but the implementation now supports both localStorage and sessionStorage viastorageBackend.📝 Suggested update
// Single point of access to the client-side persistent storage that -// Rocket.Chat shares with Meteor's accounts-base. Reads and writes use -// window.localStorage under the hood; the keys mirror the names Meteor +// Rocket.Chat shares with Meteor's accounts-base. Reads and writes use either +// window.localStorage or window.sessionStorage; the keys mirror the names Meteor // originally wrote so sessions persist across the Meteor → SDK migration.🤖 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/sdk/storage.ts` around lines 2 - 3, Update the module header comment to reflect that reads/writes may use either window.localStorage or window.sessionStorage via the storageBackend abstraction (e.g., the storageBackend variable/parameter used by getItem/setItem/removeItem functions), so replace the line that claims only window.localStorage is used with a short note that the implementation supports both localStorage and sessionStorage through storageBackend.
🤖 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.
Nitpick comments:
In `@apps/meteor/client/lib/sdk/storage.ts`:
- Around line 2-3: Update the module header comment to reflect that reads/writes
may use either window.localStorage or window.sessionStorage via the
storageBackend abstraction (e.g., the storageBackend variable/parameter used by
getItem/setItem/removeItem functions), so replace the line that claims only
window.localStorage is used with a short note that the implementation supports
both localStorage and sessionStorage through storageBackend.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7b8d48ac-14af-44d2-a688-cc75cb0b1dd5
📒 Files selected for processing (1)
apps/meteor/client/lib/sdk/storage.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). (4)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- 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/lib/sdk/storage.ts
🧠 Learnings (5)
📚 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/lib/sdk/storage.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/lib/sdk/storage.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/lib/sdk/storage.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/lib/sdk/storage.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/lib/sdk/storage.ts
🔇 Additional comments (2)
apps/meteor/client/lib/sdk/storage.ts (2)
17-31: LGTM!
61-66: LGTM!Also applies to: 69-74, 80-85
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| window.addEventListener('load', function() { | ||
| if (window.localStorage) { | ||
| Object.keys(window.localStorage).forEach(function(key) { | ||
| window.sessionStorage.setItem(key, window.localStorage.getItem(key)); | ||
| }); | ||
| window.localStorage.clear(); | ||
| Meteor._localStorage = window.sessionStorage; | ||
| Accounts.config({ clientStorage: 'session' }); | ||
| } | ||
| settings.watchMultiple(['Custom_Script_Logged_Out', 'Custom_Script_Logged_In', 'Custom_Script_On_Logout'], () => { | ||
| const content = getContent(); | ||
| addScript('scripts', content); | ||
| }); |
There was a problem hiding this comment.
this was the first thing to happen after a page load. do we no longer need this behavior? Or are we creating a regression/chance for a race condition? Do we need all these modifications?
| const getStorageForBackend = (backend: StorageBackend): Storage | undefined => { | ||
| if (typeof window === 'undefined') { | ||
| return undefined; | ||
| } | ||
|
|
||
| try { | ||
| return backend === 'session' ? window.sessionStorage : window.localStorage; | ||
| } catch { | ||
| return undefined; | ||
| } | ||
| }; |
There was a problem hiding this comment.
that's what I was expecting from this fix.
| export const setStorageBackend = (backend: StorageBackend): boolean => { | ||
| if (backend === storageBackend) { | ||
| return true; | ||
| } | ||
|
|
||
| if (!moveLoginKeys(backend)) { | ||
| return false; | ||
| } | ||
|
|
||
| storageBackend = backend; | ||
| return true; | ||
| }; |
There was a problem hiding this comment.
Is all this is to fix the regression or some improvement you've seen? I think it should go to 8.6.0.
There was a problem hiding this comment.
3 issues found across 5 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Co-authored-by: gabriellsh <40830821+gabriellsh@users.noreply.github.com>
DDPSDK.create can return a sealed instance, making the storage hook assignment throw at boot. Accounts.config also throws when called twice with a conflicting value. Both failures aborted client bootstrap during E2EE login, leaving public_key absent in localStorage and crashing the page mid-test.
Default configuredStorageBackend to 'local' so the startup pass is a no-op when the setting is off — matches the in-memory storageBackend default. Coerce peek/window fallback to a boolean so an undefined cache no longer routes through the changeStorageBackend side effects, and guard the SDK call in case the storage hook failed to attach. Restores E2EE key writes to localStorage when the setting is disabled.
Proposed changes (including videos or screenshots)
Reintroduces the behavior of switching from localStorage to sessionStorage when the Accounts_ForgetUserSessionOnWindowClose setting is enabled.
Unskips the test.
This fixes the workspace client being broken after enabling the setting, but it's probably not the whole story.
Issue(s)
CORE-2236
Steps to test or reproduce
Go to Workspace → Settings → Account
enable Accounts_ForgetUserSessionOnWindowClose
Save the setting
Go to a channel
Refresh the page or open a new tab
Expected Behavior
If refreshing, the user should stay logged in
If opening in a new tab, the user should be able to log back in
Actual Behavior
The user can’t log in; it gets stuck on the loading page
on a new tab and had the same issue, only started working again once I disabled the setting
Further comments
Root cause: #40479
Summary by CodeRabbit
New Features
Tests