Skip to content

Conversation

@marco-saia-datadog
Copy link
Member

What does this PR do?

Refactors relevant modules to use the getGlobalInstance() singleton pattern.

Motivation

Prevents problems caused by static properties having different values when imported from multiple sources.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@marco-saia-datadog marco-saia-datadog requested a review from a team as a code owner December 9, 2025 16:14
@marco-saia-datadog marco-saia-datadog self-assigned this Dec 9, 2025
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/chore/use-singleton-helper branch from 3f8827b to 8210b19 Compare December 9, 2025 17:12
sbarrio
sbarrio previously approved these changes Dec 10, 2025
Copy link
Contributor

@sbarrio sbarrio left a comment

Choose a reason for hiding this comment

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

I feel safer already 👌

@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-12493/rum-session-id-based-trace-sampling branch 2 times, most recently from 3e0c785 to bfdb696 Compare December 15, 2025 09:42
Base automatically changed from marcosaia/RUM-12493/rum-session-id-based-trace-sampling to feature/v3 December 15, 2025 10:59
@marco-saia-datadog marco-saia-datadog dismissed sbarrio’s stale review December 15, 2025 10:59

The base branch was changed.

sbarrio and others added 4 commits December 15, 2025 12:12
* Fixes an issue that happens consistently on Expo, where the import
  duplicates the isInitialized state variable, preventing the SDK
  to be correctly attached to the native implementation
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/chore/use-singleton-helper branch 2 times, most recently from 13370e3 to 705b2e9 Compare December 15, 2025 11:44
sbarrio
sbarrio previously approved these changes Dec 15, 2025
* Solves an issue where the config object is duplicated for multiple imports
  leading to incorrect state management, and interaction tracking being disabled
});

it('does nothing when startTrackingViews { undefined any ', async () => {
it('does nothing when startTrackingViews { undefined any }', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Woops. Thanks 🙇

};
}

export const DdRumReactNavigationTracking = getGlobalInstance(
Copy link
Contributor

@sbarrio sbarrio Dec 15, 2025

Choose a reason for hiding this comment

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

Seeing this, I think we should do the same for DdRumReactNativeNavigationTracking.tsx (on this or on a separate PR).

this.paramsTrackingPredicate = defaultParamsPredicate;
this.viewNamePredicate = defaultViewNamePredicate;
this.viewTrackingPredicate = defaultViewTrackingPredicate;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Much cleaner ❤️

@marco-saia-datadog marco-saia-datadog merged commit b0f5a28 into feature/v3 Dec 15, 2025
9 checks passed
@marco-saia-datadog marco-saia-datadog deleted the marcosaia/chore/use-singleton-helper branch December 15, 2025 16:03
@sbarrio sbarrio mentioned this pull request Jan 22, 2026
4 tasks
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