Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-7663] Fix state/metadata set in renderer config not being cleared #1893

Merged
merged 10 commits into from
Dec 23, 2022

Conversation

yousif-bugsnag
Copy link
Contributor

@yousif-bugsnag yousif-bugsnag commented Dec 21, 2022

Goal

Any state/metadata that was added in a renderer's configuration could no be removed from that renderer

This is because we send the renderer config values to the main process, but they were also stored locally in the renderer client (because it’s using the same code as all other JS platforms)

This means both the renderer and main processes had a copy of the state, but methods like clearMetadata and clearFeatureFlags only talk to the main process

This affected user, context metadata and featureFlags config

Changeset

Updated plugin-electron-renderer-client-state-updates to clear any state from the renderer client once it has been synched to the main process

Testing

  • Manually tested clearing user, context metadata and featureFlags set in renderer config
  • Added a unit test to ensure that this state is not stored in the renderer client
  • Added integration tests to ensure that any state set in the renderer config can be cleared and will not be attached to subsequent events from that renderer

@github-actions
Copy link

github-actions bot commented Dec 21, 2022

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 43.19 kB 13.21 kB
After 43.19 kB 13.21 kB
± No change No change

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against 590215b

test/electron/fixtures/app/renderer.js Outdated Show resolved Hide resolved
test/electron/fixtures/app/renderer.js Outdated Show resolved Hide resolved
test/electron/fixtures/app/index.html Outdated Show resolved Hide resolved
test/electron/fixtures/app/index.html Outdated Show resolved Hide resolved
test/electron/features/feature-flags.feature Show resolved Hide resolved
yousif-bugsnag and others added 4 commits December 21, 2022 15:29
Co-authored-by: Joe Haines <hello@joehaines.co.uk>
Co-authored-by: Joe Haines <hello@joehaines.co.uk>
Co-authored-by: Joe Haines <hello@joehaines.co.uk>
"user": {
"id": "{REGEX:[0-9a-f]{64}}"
},
"context": "Runner",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you clear the renderer context it reverts to the default context, which is the html <title> tag

@yousif-bugsnag yousif-bugsnag merged commit fb54252 into next Dec 23, 2022
@yousif-bugsnag yousif-bugsnag deleted the PLAT-7663/electron-renderer-client-clear-state branch December 23, 2022 13:02
@gingerbenw gingerbenw mentioned this pull request Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants