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

Expose ignoreComponents as an Option #622

Open
angel3cu opened this issue Oct 21, 2024 · 7 comments
Open

Expose ignoreComponents as an Option #622

angel3cu opened this issue Oct 21, 2024 · 7 comments

Comments

@angel3cu
Copy link

@sentry/babel-plugin-component-annotate seems to have an undocumented option to ignore specific files and/or components. This is coming from the original plugin that is is based on. The option is called ignoreComponents and can be seen documented in the original FullStory plugin here.

In some cases, adding properties to a component at build time interacts with other libraries, causing them to fail. One such scenario is Mapbox, where Sentry adds data-sentry-component and data-sentry-source-file into the properties of the Source component. Mapbox validates all the properties of its React components; when it encounters the properties injected by Sentry, it fails. Even worse, since in most scenarios Sentry is only used in production, this failure won't be visible until it is too late.

The root cause of the failure here is the reactComponentAnnotation feature. It currently has a simple enabled option to turn it on and off. Given how useful the feature is for debugging issues, we would like to keep it on and only exclude the components that fail. If we could expose the underlying ignoreComponents in the Vite plugin, then that goal would be achieved.

e.g.

export default defineConfig({
  plugins: [
    ...
    sentryVitePlugin({
      ...,
      reactComponentAnnotation: {
        enabled: true,
        ignoreComponents: [
      },
    }),
  ],
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 21, 2024
@lforst
Copy link
Member

lforst commented Oct 21, 2024

@0Calories do we wanna expose this option? Can we find a simpler interface than type IgnoredComponent = [file: string, component: string, element: string]?

@angel3cu
Copy link
Author

Hello Sentry team! I was wondering if you have any updates on this issue? Thank you in advance. 🙂

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 25, 2024
@chargome
Copy link
Member

chargome commented Nov 26, 2024

Hey @angel3cu, this feature is currently in our backlog – I'll bring it up again this week as I think this generally makes sense.

@angel3cu
Copy link
Author

Hey @angel3cu, this feature is currently in our backlog – I'll bring it up again this week as I think this generally makes sense.

Thank you @chargome! I really appreciate this. 🙂

@SerdarSanri
Copy link

any updates on this feature? Also causing warning messages in MaterialUI components. Image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 8, 2024
@AbhiPrasad
Copy link
Member

cc @0Calories

@0Calories
Copy link
Member

@angel3cu Thanks for bringing this up, I have a PR that I've been working on to address this: #617

I'm not a fan of the original interface which is why I've been re-doing it, just need to find an opportunity to finish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

6 participants