fix(chat): don't re-add a dropped chat when an older page fails

Merged
RA
5h ago
+5-3

Description

Follow-up to #17025 (CodeRabbit thread on pagedSession.ts). updateSessionData creates a session when it is missing. If a chat left the store while an older page loaded and the request then failed, the error path added an empty session back. The error path now writes only if the session is still in the store, the same as the finally block.

How Has This Been Tested?

Code review only. The change is a one-line guard.

Docs

  • Customer-facing change: I updated documentation/ (text and screenshots).
  • No docs change needed (internal, tests, CI, or multi-tenant cloud only).

Additional Options

  • [Optional] Please cherry-pick this PR to the latest release version.

Summary by cubic

Stops a failed older-page load from re-adding a chat that left the store.

Previously, if a chat was removed while an older page was loading and that request then failed, the error path added an empty session back, because updateSessionData creates sessions that are missing. The error path now only updates the session if it's still in the store, matching the guard already used in the finally block.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where a failed attempt to load older chat messages could incorrectly update message availability for a session that no longer exists.