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 newTracker typing to accurately return null or undefined (fix #1167) #1175

Conversation

igneel64
Copy link
Contributor

Fix correct typing issue for newTracker possibly returning:

  • null when a tracker is already initialized with the same tracker id.
  • undefined when we are not in a browser context.

(close #1167)

@bundlemon
Copy link

bundlemon bot commented Apr 17, 2023

BundleMon

Files added (6)
Status Path Size Limits
libraries/browser-tracker-core/dist/index.mod
ule.js
+25.21KB 26KB / +10%
trackers/javascript-tracker/dist/sp.js
+24.22KB 25KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+14.52KB 15KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+14.36KB 15KB / +10%
libraries/tracker-core/dist/index.module.js
+13.36KB 15KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.51KB 5KB / +10%

Total files change +95.17KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Copy link
Contributor

@matus-tomlein matus-tomlein left a comment

Choose a reason for hiding this comment

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

Looks good! I'm just wondering whether we can release this in v3 or should wait for v4. I know that it doesn't change the behaviour of the tracker, but the change in the type can cause some user code to produce typescript errors with handling the null or undefined that might have not been produced before. I think this could be considered a breaking as users would need to change how they use the result of newTracker(). So my opinion is that we should release this in v4.

@igneel64
Copy link
Contributor Author

@matus-tomlein
Yeap had the same thought and was waiting for some feedback. Will point to v4

@igneel64 igneel64 changed the base branch from release/3.10.0 to release/4.0.0 April 17, 2023 07:49
@igneel64 igneel64 force-pushed the fix/1167-correct-newTracker-function-on-browser-tracker branch from 20ed72b to 7f7b010 Compare April 17, 2023 07:51
@igneel64 igneel64 force-pushed the fix/1167-correct-newTracker-function-on-browser-tracker branch from 7f7b010 to b210872 Compare August 16, 2023 08:43
@igneel64 igneel64 force-pushed the fix/1167-correct-newTracker-function-on-browser-tracker branch from b210872 to 61e1d46 Compare August 16, 2023 09:08
@igneel64 igneel64 merged commit 7b751c7 into release/4.0.0 Aug 16, 2023
3 checks passed
@igneel64 igneel64 deleted the fix/1167-correct-newTracker-function-on-browser-tracker branch August 16, 2023 11:11
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.

None yet

2 participants