getCmp - #3924
Merged
Merged
getCmp#3924
getCmp#3924Conversation
oliverlloyd
requested review from
a team,
JamieB-gu and
marsavar
as code owners
February 4, 2022 10:23
Contributor
Author
|
Size Change: 0 B Total Size: 1.18 MB ℹ️ View Unchanged
|
mxdvl
approved these changes
Feb 4, 2022
mxdvl
left a comment
Contributor
There was a problem hiding this comment.
I think erroring on the race condition should be good enough!
Contributor
|
Did we see any errors crop up from this? |
Contributor
Author
This code doesn't do anything, it's just adding a file. The PR to actually use it is this one, which is blocked on the You Tube works |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
This PR adds a small lib called
getCmpwhich returns the version of thecmpobject that gets placed onwindow.guCmpHotFixWhy?
As we move more code over to the
Islandpattern we are starting to hit issues where the cmp lib is not server safe. If we refactor DCR's access to cmp to use this window object then this allows us to avoid the import, which is where we're getting errors on the server.This abstraction is a helper utility to make that refactor. The main thing it provides is a check and a call to Sentry in the event that the property is not available. We believe that the property will always be there - we run
bootCmpvery early - but it might not be and we want to be aware if this happens. If we do see these errors, then it suggests we have a race condition and that we will need to implement some form of queue while the code waits for this value to be set.