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

Added a check for spotlight v1.x.x to not load sentry sdk >= v8 #401

Open
wants to merge 3 commits into
base: 1.x
Choose a base branch
from

Conversation

Shubhdeep12
Copy link
Collaborator

@Shubhdeep12 Shubhdeep12 commented May 28, 2024

Before opening this PR:

  • I added a Changeset Entry with pnpm changeset:add
  • I referenced issues that this PR addresses

Added a check for sentry integration in Spotlight, for v1.x.x to load only if -

  • no browser sdk found.
  • browser sdk with version <= 7.x.x

image

Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
spotlightjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2024 1:14pm

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Good idea! heads-up, I'm gonna work soon on the v2 stable version. Just need to adjust the window.__SENTRY__ code a bit to get it working with getsentry/sentry-javascript#12206
Anyway, this isn't relevant for this PR as we'll merge it into v1

notificationCount: {
count: errorsCount,
severe: errorsCount > 0,
if (checkBrowserSDKVersion()) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we extract the two integrations here so that not the entire code is indented by checkBrowserSDKVersion?

Copy link
Member

Choose a reason for hiding this comment

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

So basically, do something like:

if (checkBrowserSDKVersion()) {
  return _sentryIntegration();
} else {
  return _sdkNotCompatibleSentryIntegration()
}

No particular strong feelings about naming or details just wanna keep this somewhat readable :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is done

import { WindowWithSentry } from '../types';

export function checkBrowserSDKVersion() {
const spotlightV1SupportedSentryRegex = new RegExp(SDK_VERSION_SUPPORT_REGEX);
Copy link
Member

Choose a reason for hiding this comment

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

l: I'd rather just inline the regex here instead of initializing a new RegExp with the constant. Makes things a bit simpler and as far as I can tell, we're not reusing the regex.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup, sure

@@ -7,17 +7,17 @@ import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs>
<TabItem label="npm">
```sh
npm add @spotlightjs/spotlight
npm i @spotlightjs/spotlight --save-dev
Copy link
Member

Choose a reason for hiding this comment

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

good catch!

@Shubhdeep12
Copy link
Collaborator Author

hey @Lms24

@Lms24
Copy link
Member

Lms24 commented May 31, 2024

@Shubhdeep12 thanks a lot for making the changes! I think this looks good but I just had a revelation:

The plan for the v2 release is to merge v2_dev into main once we go stable. Before this merge, we'll branch off a v1 branch from main to which we can theoretically apply patches if we need to create v1 patches in the future. v2 development will continue on main.

With this in mind, we don't necessarily want this commit in the history for v2, but only for v1.So I suggest we wait with merging until v2 is stable and only then merge it into the v1 branch. Does that make sense to you?

I'm targeting Monday for v2 stable by the way so the wait shouldn't be too long 🤞

@Shubhdeep12
Copy link
Collaborator Author

Sounds great! @Lms24

The main reason for this patch was for the users who were getting confused and were trying to use the spotlight with sentry v8.
We can wait and merge it in v1 branch.

@Lms24
Copy link
Member

Lms24 commented May 31, 2024

Yup, that makes sense, as I said, I think the change is a good idea! Also, waiting for stable gives us the additional bonus that people will feel less sceptical about updating to a stable version than to an alpha version.

@Shubhdeep12 Shubhdeep12 changed the title Added a check for spotlight v1.x.x to not load sentry sdk >= v8 [TO-BE-MERGE-AFTER-STABLE-V2] Added a check for spotlight v1.x.x to not load sentry sdk >= v8 Jun 5, 2024
@Shubhdeep12 Shubhdeep12 changed the title [TO-BE-MERGE-AFTER-STABLE-V2] Added a check for spotlight v1.x.x to not load sentry sdk >= v8 Added a check for spotlight v1.x.x to not load sentry sdk >= v8 Jun 21, 2024
@BYK
Copy link
Member

BYK commented Jun 26, 2024

Is this still relevant @Lms24 and @Shubhdeep12?

@Lms24
Copy link
Member

Lms24 commented Jun 26, 2024

Yup, still relevant. Should go into 1.x (feel free to adjust as you see fit!)

@Shubhdeep12 Shubhdeep12 changed the base branch from main to 1.x June 27, 2024 12:19
@BYK
Copy link
Member

BYK commented Jun 27, 2024

Is there a strong reason for us to support 1.x branch and do hotfixes for that?

@Shubhdeep12
Copy link
Collaborator Author

Is there a strong reason for us to support 1.x branch and do hotfixes for that?

All new fixes and features will be added to 2.x(main branch) only.

This specific fix is only added for the users using spotlight v 1.x with sentry sdk v >=8.x because there was a breaking change in sentry js sdk v8.x, which spotlight 1.x doesn't support.

@BYK
Copy link
Member

BYK commented Jun 27, 2024

This specific fix is only added for the users using spotlight v 1.x with sentry sdk v >=8.x because there was a breaking change in sentry js sdk v8.x, which spotlight 1.x doesn't support.

Understand this part. Asking if there's anyone out there relying on v1.x or a good reason for us to maintain v1.x (otherwise I'll just close this PR and do not support v1)

@Lms24
Copy link
Member

Lms24 commented Jul 19, 2024

image

@BYK Seems like v1 is still used by a lot of people. If it's not too much work, I'd vote we merge this and cut a final v1 release to let people know about the need to update to v2 if they use a v8 JS SDK. No strong feelings though, I'll let you make the call.

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.

3 participants