Skip to content

Conversation

@lucas-zimerman
Copy link
Collaborator

This change introduces a break change thus is going to a major version.

The main change was done here:

export function init<T>(
  passedOptions: CapacitorOptions & T,
  originalInit: (passedOptions: T & BrowserOptions) => void = browserInit,

to

export function init(
  passedOptions: CapacitorOptions,
  originalInit: (passedOptions:BrowserOptions) => void = browserInit,
): void {

The previous change was required since a sibling Option may have additional parameters that are required in order to initialize it, adding T helped with it, but also brought two problems:

  • items that are supposed to be removed from CapacitorOptions are ignored since T inherits the items again from BrowserOptions.
  • parameters from T will have no JSDoc due to the nature of how TypeScirpt deals with it.

The PR fixes both issues on the following way:

  • Remove T and enforce all options to be CapacitorOptions. This way it's easier to remove items that aren't supposed to be used with Capacitor.
  • Migrated Sibling options into siblingOptions: This sadly wasn't a nice change, since it will require additional changes from users during migration, BUT, it also brings JSDocs back to their respective sibling options, so required fields from Vue/Nuxts are again required to be defined, instead of being optional.

With that we were able to eliminate the _experimental field, removing all the items that were deprecated and also removed the autoSessionTracking that was found out to be removed anyway from the newer versions of Sentry JavaScript.

Screenshots of a SDK init with siblngOptions:
image
image
Required field missing that wasn't warned before:
image

@lucas-zimerman lucas-zimerman marked this pull request as ready for review November 28, 2025 13:52
@antonis
Copy link
Contributor

antonis commented Nov 28, 2025

@sentry review

Comment on lines 30 to 33
};
finalOptions.siblingOptions && delete finalOptions.siblingOptions;

if (finalOptions.enabled === false || NATIVE.platform === 'web') {

This comment was marked as outdated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we don't want

dsn,
siblingOptions: {
vueOptions:{ 
app: app
}
}

to be present, we actually want it to be together with the other options when setting the browser options, like

dsn,
app: app

Comment on lines +40 to +52
* When set to `false`, Sentry will suppress reporting of all props data
* from your Vue components for privacy concerns.
*/
attachProps: boolean;

/**
* By default, Sentry attaches an error handler to capture exceptions and report them to Sentry.
* When `attachErrorHandler` is set to `false`, automatic error reporting is disabled.
*
* Usually, this option should stay enabled, unless you want to set up Sentry error reporting yourself.
* For example, the Sentry Nuxt SDK does not attach an error handler as it's using the error hooks provided by Nuxt.
*
* @default true

This comment was marked as outdated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would like to keep it as is since it's an exact copy of Vue options.

Comment on lines 75 to +83
}

const browserOptions = {
...passedOptions.siblingOptions?.vueOptions,
...passedOptions.siblingOptions?.nuxtClientOptions,
...finalOptions,
autoSessionTracking:
NATIVE.platform === 'web' && finalOptions.enableAutoSessionTracking,
} as BrowserOptions & T;
} as BrowserOptions;

This comment was marked as outdated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BrowserOptions is a common type, and it's used for Angular/React. It's also the same type for Vue/Nuxt with additional parameters.
It indeed extends what is defined by BrowserOptions but it allows the original options to be preserved for the following SDK init.

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

LGTM 🚀
Thank you for your work on this Lucas 🙇

@lucas-zimerman lucas-zimerman merged commit 457eb11 into V3 Nov 28, 2025
12 checks passed
@lucas-zimerman lucas-zimerman deleted the lz/v3/ref-init branch November 28, 2025 15:58
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