Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

fix: Livechat popout not syncing department and custom fields

Open aleksandernsilva opened this issue 8 months ago • 4 comments

Proposed changes (including videos or screenshots)

Google’s privacy changes (specifically storage partitioning) have affected how localStorage works across iframes and child windows. As a result, Livechat's popout mode lost access to shared state and became less reactive.

This PR is the first step toward restoring reactivity in popout mode. It initializes the popout window with the token, iframe data, and custom fields queue.

Future work will expand this logic to cover the rest of the Livechat internal state to fully restore reactivity to the popout mode.

Issue(s)

CTZ-156 CTZ-204

Steps to test or reproduce

⚠️ To be able to properly test this you must embed Livechat in a different origin.

  • Embed Livechat in a different origin
  • set custom field, department and/or theme data
window.RocketChat(function() {
   this.setTheme({ color: 'rebeccapurple' });
   this.setDepartment('departmentid');
   this.setCustomField('customfield', 'value')
})
  • Click "Expand chat" in the Livechat widget header
  • New window should open (popout) with the information pre-loaded

Further comments

aleksandernsilva avatar Jun 02 '25 17:06 aleksandernsilva

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

dionisio-bot[bot] avatar Jun 02 '25 17:06 dionisio-bot[bot]

⚠️ No Changeset found

Latest commit: 467297ed475af1fcdab9b05d4d78266149b52a1e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Jun 02 '25 17:06 changeset-bot[bot]

PR Preview Action v1.6.1 :---: |

:rocket: View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-36125/

|
Built to branch gh-pages at 2025-06-16 18:50 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

github-actions[bot] avatar Jun 02 '25 18:06 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.46%. Comparing base (9fd2be4) to head (467297e). Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #36125      +/-   ##
===========================================
+ Coverage    63.96%   64.46%   +0.50%     
===========================================
  Files         3058     3138      +80     
  Lines       103632   104921    +1289     
  Branches     19471    19789     +318     
===========================================
+ Hits         66284    67638    +1354     
+ Misses       34728    34602     -126     
- Partials      2620     2681      +61     
Flag Coverage Δ
e2e 57.66% <ø> (+1.65%) :arrow_up:
unit 69.07% <ø> (+0.04%) :arrow_up:

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

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

codecov[bot] avatar Jun 02 '25 18:06 codecov[bot]

/patch

scuciatto avatar Jun 24 '25 18:06 scuciatto

Pull request #36299 added to Project: "Patch 7.7.2"

dionisio-bot[bot] avatar Jun 24 '25 18:06 dionisio-bot[bot]