Skip to content

Conversation

@aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Oct 30, 2025

Proposed changes (including videos or screenshots)

This PR fixes an issue in the admin settings page where settings were not being displayed after logging out and back into the workspace. The issue occurred because the necessary cleanup logic wasn’t executed during logout, leaving stale data from the previous session and preventing the settings cache from initializing correctly.

Before:

settings-not-working.mov

After

settings-working.mov

Issue(s)

CORE-1257

Steps to test or reproduce

  1. Log in to the Rocket.Chat application using an administrator account.
  2. Navigate to any settings section (Workspace -> Settings).
  3. Observe that the settings options are displayed correctly.
  4. Log out of the administrator account.
  5. Log back into the same administrator account.
  6. Immediately navigate to any settings section (Workspace -> Settings).
  7. Observe the settings page content.

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where the administration settings page could fail to display settings after logging out and back in.
  • Tests

    • Added end-to-end coverage verifying the settings list displays correctly before and after logout/login.
  • Refactor

    • Moved startup of permission and private settings listeners to occur during the loading/initialization flow.
  • Chore

    • Added a changeset entry for a patch release.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 30, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2025

🦋 Changeset detected

Latest commit: 9082481

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

Walkthrough

Defers cached-store listen() calls from component mount to the post-cache-initialization path for private settings and permissions, adds an E2E test that verifies settings remain visible after logout/login, and introduces a patch changeset recording the fix.

Changes

Cohort / File(s) Summary
Changeset
.changeset/stupid-cameras-nail.md
Adds a patch changeset entry documenting the fix for administration settings not listing after logout/login.
Settings provider
apps/meteor/client/providers/SettingsProvider.tsx
During the loading/init path, calls listen() on cached collections when they are instances of PrivateCachedStore before awaiting init() instead of only after overall readiness.
Authorization provider
apps/meteor/client/providers/AuthorizationProvider.tsx
Removes mount-time useEffect that called PermissionsCachedStore.listen() and relocates listen() invocation into the async init/loading path.
E2E tests
apps/meteor/tests/e2e/administration-settings.spec.ts
Adds page-object imports and a test flow that asserts settings list is present, logs out, logs back in via page objects, navigates to Workspace → Settings, and re-asserts the settings list is still displayed.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as Admin UI
    participant SettingsProv as SettingsProvider
    participant AuthProv as AuthorizationProvider
    participant PrivateStore as PrivateCachedStore
    participant PermissionsStore as PermissionsCachedStore

    User->>UI: Open Settings
    UI->>SettingsProv: request settings
    SettingsProv->>PrivateStore: initialize/load cached collection
    PrivateStore-->>SettingsProv: cached collection ready
    SettingsProv->>PrivateStore: call listen()  %%[note `#ccffcc`]%%
    PrivateStore-->>SettingsProv: start observing

    User->>UI: Logout → Login
    UI->>AuthProv: init after login
    AuthProv->>PermissionsStore: initialize/load cached permissions
    PermissionsStore-->>AuthProv: cached collection ready
    AuthProv->>PermissionsStore: call listen()  %%[note `#ccffcc`]%%
    PermissionsStore-->>AuthProv: start observing

    Note over SettingsProv,AuthProv: listen() is deferred until cached collections are ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to:
    • Race conditions and cleanup across logout/login cycles where listen() is deferred.
    • Type/instance checks for PrivateCachedStore before calling listen().
    • Stability and selectors in the new E2E test and correctness of page-object usage.

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • jeanfbrito

Poem

🐰 A little hop, a careful tweak,
Listeners wake when caches speak.
Tests chase logouts, logins too,
Settings stay visible—no refresh to do. 🎉

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and clearly summarizes the main fix addressing the root cause of settings not displaying after logout and login.
Linked Issues check ✅ Passed The code changes successfully address the linked issue CORE-1257 by ensuring proper cache initialization and listener setup during the loading flow.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the settings cache initialization issue; the changeset, provider modifications, and test additions all support the core fix.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/settings-not-loading-after-logout

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Fixes administration settings page not listing the settings after logging out and back into the workspace
@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.12%. Comparing base (7fd62c1) to head (9082481).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37345      +/-   ##
===========================================
- Coverage    68.13%   68.12%   -0.02%     
===========================================
  Files         3364     3364              
  Lines       115811   115808       -3     
  Branches     20903    20857      -46     
===========================================
- Hits         78911    78895      -16     
+ Misses       34216    34210       -6     
- Partials      2684     2703      +19     
Flag Coverage Δ
e2e 57.50% <100.00%> (-0.01%) ⬇️
unit 72.13% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aleksandernsilva aleksandernsilva marked this pull request as ready for review October 30, 2025 16:12
@aleksandernsilva aleksandernsilva requested a review from a team as a code owner October 30, 2025 16:12
@tassoevan
Copy link
Contributor

I wonder if the listen() method shouldn't be called along with init(), since both should be called only once. A similar change could be applied to the AuthorizationProvider.

@aleksandernsilva aleksandernsilva marked this pull request as draft October 31, 2025 17:53
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6346329 and b0f0613.

📒 Files selected for processing (2)
  • apps/meteor/client/providers/AuthorizationProvider.tsx (2 hunks)
  • apps/meteor/client/providers/SettingsProvider.tsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/meteor/client/providers/SettingsProvider.tsx (1)
apps/meteor/client/lib/cachedStores/CachedStore.ts (1)
  • PrivateCachedStore (382-404)
apps/meteor/client/providers/AuthorizationProvider.tsx (1)
apps/meteor/client/cachedStores/PermissionsCachedStore.ts (1)
  • PermissionsCachedStore (6-10)
⏰ 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: CodeQL-Build
  • GitHub Check: CodeQL-Build

@aleksandernsilva aleksandernsilva force-pushed the fix/settings-not-loading-after-logout branch from b0f0613 to 4205d46 Compare October 31, 2025 18:20
@aleksandernsilva aleksandernsilva marked this pull request as ready for review October 31, 2025 19:05
@dougfabris dougfabris added this to the 7.13.0 milestone Nov 4, 2025
Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/meteor/tests/e2e/administration-settings.spec.ts (2)

26-29: Add positive assertion and extract repeated locator.

The test currently only verifies that "No results found" is not visible. Consider:

  1. Adding a positive assertion to verify actual settings content is displayed (e.g., checking for a specific setting or settings list element)
  2. Extracting the repeated locator to a constant for reuse

This will make the test more robust and maintainable.

Example refactor:

+const noResultsMessage = page.getByText('No results found');
+
 await test.step('should list settings on load', async () => {
-  await expect(page.getByText('No results found')).not.toBeVisible();
+  await expect(noResultsMessage).not.toBeVisible();
+  // Verify actual settings are present
+  await expect(page.getByRole('region', { name: 'Settings' })).toBeVisible();
 });

As per coding guidelines

Also applies to: 41-42


32-32: Remove the unnecessary sidebar.close() call to keep the test focused on verifying settings persistence across logout/login.

The sidebar.close() operation is pure UI cleanup that doesn't affect logout functionality. Examination of other E2E tests shows this pattern is unique to this test—all other logout calls proceed directly without closing the sidebar first. Since logout is a server-side operation independent of UI state, and the test's core verification is whether settings display persists after logout/login, this line should be removed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4205d46 and 004fce8.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/administration-settings.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/meteor/tests/e2e/**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.spec.ts: All Playwright test files must be located under apps/meteor/tests/e2e/ and use the .spec.ts extension (e.g., login.spec.ts)
Use descriptive test names that clearly communicate expected behavior
Use test.beforeAll() and test.afterAll() for setup and teardown
Use test.step() to organize complex test scenarios
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) consistently
Prefer web-first assertions (e.g., toBeVisible, toHaveText)
Use expect matchers (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements
Maintain test isolation between test cases
Ensure a clean state for each test execution
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}: Write concise, technical TypeScript/JavaScript with accurate typing
Follow DRY by extracting reusable logic into helper functions or page objects
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,tsx}: Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Store commonly used locators in variables/constants for reuse
Use page.waitFor() with specific conditions and avoid hardcoded timeouts
Implement proper wait strategies for dynamic content
Follow the Page Object Model pattern consistently

Files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
🧠 Learnings (11)
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize and place Page Object implementations under apps/meteor/tests/e2e/page-objects/

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Follow the Page Object Model pattern consistently

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (test, page, expect) consistently

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx} : Follow DRY by extracting reusable logic into helper functions or page objects

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Store commonly used locators in variables/constants for reuse

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure a clean state for each test execution

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Use page.waitFor() with specific conditions and avoid hardcoded timeouts

Applied to files:

  • apps/meteor/tests/e2e/administration-settings.spec.ts
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/administration-settings.spec.ts (3)
apps/meteor/tests/e2e/page-objects/admin-settings.ts (1)
  • AdminSettings (5-45)
apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (1)
  • HomeSidenav (7-254)
apps/meteor/tests/e2e/page-objects/login.ts (1)
  • LoginPage (9-55)
⏰ 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). (7)
  • GitHub Check: 🔨 Test Storybook / Test Storybook
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 📦 Meteor Build - coverage
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (5)
apps/meteor/tests/e2e/administration-settings.spec.ts (5)

2-4: LGTM! Imports align with Page Object Model.

The new imports are correctly structured and necessary for the logout/login test flow.


12-13: LGTM! Page object declarations follow established pattern.


17-19: LGTM! Page objects correctly initialized in beforeEach.


21-24: LGTM! Test structure follows best practices.

Good use of nested describe block and beforeEach for navigation.


31-39: Test flow correctly reproduces the reported bug scenario.

The logout/login cycle followed by navigation to Settings accurately matches the steps to reproduce from the PR description.

@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Nov 5, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Nov 5, 2025
@kodiakhq kodiakhq bot merged commit 4d7390c into develop Nov 6, 2025
63 checks passed
@kodiakhq kodiakhq bot deleted the fix/settings-not-loading-after-logout branch November 6, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants