[web] Define loadPropensityScript before use (#26813)
This prevents the bug "ReferenceError: Cannot access uninitialized variable" for users who don't have `window.requestIdleCallback`. Fixes https://overleaf.sentry.io/issues/6724866295 GitOrigin-RevId: 129dcb72f24dc901ad600253bab7c58673e44321
This commit is contained in:
@@ -6,10 +6,6 @@ import {
|
|||||||
|
|
||||||
const { propensityId } = getMeta('ol-ExposedSettings')
|
const { propensityId } = getMeta('ol-ExposedSettings')
|
||||||
|
|
||||||
if (propensityId) {
|
|
||||||
createTrackingLoader(() => loadPropensityScript(propensityId), 'Propensity')
|
|
||||||
}
|
|
||||||
|
|
||||||
const loadPropensityScript = (id: string) => {
|
const loadPropensityScript = (id: string) => {
|
||||||
insertScript({
|
insertScript({
|
||||||
src: 'https://cdn.propensity.com/propensity/propensity_analytics.js',
|
src: 'https://cdn.propensity.com/propensity/propensity_analytics.js',
|
||||||
@@ -21,3 +17,7 @@ const loadPropensityScript = (id: string) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (propensityId) {
|
||||||
|
createTrackingLoader(() => loadPropensityScript(propensityId), 'Propensity')
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user