RocketChat / RocketChat/Rocket.Chat

CachedStore token comparison breaks public cache validation; PlanTag relies on unstable license tags

Open
#38,328 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description

Public cached collections use an undefined cache token, which leads to unstable cache validation across reloads. This indirectly causes inconsistent license state usage in UI components such as PlanTag, resulting in missing or repeated plan tags.

This issue is reproducible on the latest Rocket.Chat version and affects both cache correctness and UI reliability.

Environment
• Operating System: macOS 14.x (ARM64)
• Browser: brave
• Rocket.Chat version: Latest develop branch (commit: )
• Deployment: Local development setup

Expected behavior
• Public cached collections should have deterministic cache validation across reloads.
• Cache entries should not be invalidated or accepted ambiguously.
• License-based UI components (e.g. PlanTag) should render consistently after reload, login, or navigation.

Actual behavior
• Public cached collections (PublicCachedStore) use undefined as a cache token.
• Cache validation relies on this comparison:

data.token !== this.getToken()

•	When both values are undefined, cache validity becomes unreliable.
•	As a result, license data may be partially available, causing UI components like PlanTag to render inconsistently or fall back incorrectly.

Steps to reproduce
1. Run Rocket.Chat locally using the latest develop branch.
2. Login as an admin user.
3. Reload the application multiple times or log out and log back in.
4. Observe public cached collections (e.g. permissions, public settings) being reloaded inconsistently.
5. Navigate to any view rendering PlanTag.
6. Notice missing, duplicated, or inconsistent plan tags.

Relevant code

PublicCachedStore token implementation

export class PublicCachedStore<T extends IRocketChatRecord, U = T> extends CachedStore<T, U> {
protected override getToken() {
return undefined;
}
}

Cache validation logic

if (data.version < this.version || data.token !== this.getToken()) {
return false;
}

Proposed solution
• Use an explicit, stable token for public cached stores (e.g. 'public').
• This makes cache validation deterministic and avoids ambiguous undefined comparisons.
• Normalize license tag handling in PlanTag to guard against incomplete license state during cache rehydration.

Logs
[

Image

]

Additional context

This issue does not introduce new features or behavior changes.
It improves cache correctness and UI consistency while keeping existing logic intact.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating PublicCachedStore.getToken and the CachedStore cache-validation comparison shown in the issue, then inspect PlanTag's handling of license state. Done means public cached collections validate deterministically across reloads and PlanTag renders consistently during reload, login, and navigation; verify using the listed reproduction steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.