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

fix: Page titles in breadcrumbs should not change #551

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

CliftonH
Copy link
Contributor

We noticed an issue where page titles were showing up in breadcrumbs and discovered that the breadcrumbs' data properties are references to RENDERERS object here. Thus, if the page title changes after a breadcrumb is created but before it is sent with an event, this handler will also change the data property of the breadcrumb.

This change prevents that by setting the data property of the breadcrumb to a clone of the renderer state. Also, this change prevents the breadcrumb integration from modifying the renderer state when writing its data prop.

…reference, preventing breadcrumb integration from modifying renderer state
@@ -183,14 +183,10 @@ export class ElectronBreadcrumbs implements Integration {
};

if (id) {
const state = getRendererProperties(id);
breadcrumb.data = { ...getRendererProperties(id) };
Copy link
Contributor

Choose a reason for hiding this comment

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

getRendererProperties could return null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I'm mistaken, getRendererProperties should only ever return some object or undefined, which this change should handle. Am I overlooking something?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh interesting, I didn't think ...null was valid JS 🤔 Apparently it is?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this should be fine to cover the case here.

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! Took the liberty of editing the title to match our conventions. We can try to get this released tomorrow, @timfish does that work for you?

@AbhiPrasad AbhiPrasad changed the title Fix page titles in breadcrumbs fix: Remove page titles in breadcrumbs Sep 12, 2022
@timfish
Copy link
Collaborator

timfish commented Sep 12, 2022

To release we either need to revert #542 or merge #550 since I found a data race in the async file store changes.
Reverting #542 is certainly easier!

@AbhiPrasad AbhiPrasad changed the title fix: Remove page titles in breadcrumbs fix: make sure page titles in breadcrumbs are removed Sep 12, 2022
@timfish timfish changed the title fix: make sure page titles in breadcrumbs are removed fix: Page titles in breadcrumbs should not change Sep 12, 2022
@timfish timfish merged commit a41b380 into getsentry:master Sep 12, 2022
@lobsterkatie
Copy link
Member

@timfish - We've got some folks asking if we could write a test for this fix, to make sure there's never a regression in the future. Is that something you might be able to help with?

cc @yuval-sentry

@timfish
Copy link
Collaborator

timfish commented Nov 17, 2022

Yes, I will add some tests!

@yuval-sentry
Copy link
Member

Thank you!!!

@lobsterkatie
Copy link
Member

Thanks, @timfish!

timfish added a commit to timfish/sentry-electron that referenced this pull request Nov 19, 2022
timfish added a commit to timfish/sentry-electron that referenced this pull request Nov 19, 2022
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.

6 participants