mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #27848 from overleaf/as-compile-warning-teardown
[web] Tear down 10s-timeout-warning split test GitOrigin-RevId: ca8faf77bc73073e9fc126d9d722fe568921c1c3
This commit is contained in:
@@ -16,7 +16,6 @@ function resetMeta() {
|
||||
window.metaAttributesCache.set('ol-projectHistoryBlobsEnabled', true)
|
||||
window.metaAttributesCache.set('ol-capabilities', ['chat'])
|
||||
window.metaAttributesCache.set('ol-compileSettings', {
|
||||
reducedTimeoutWarning: 'default',
|
||||
compileTimeout: 20,
|
||||
})
|
||||
window.metaAttributesCache.set('ol-ExposedSettings', {
|
||||
|
||||
@@ -736,12 +736,6 @@ const _ProjectController = {
|
||||
isOverleafAssistBundleEnabled &&
|
||||
(await ProjectController._getAddonPrices(req, res))
|
||||
|
||||
const reducedTimeoutWarning =
|
||||
await SplitTestHandler.promises.getAssignmentForUser(
|
||||
project.owner_ref,
|
||||
'10s-timeout-warning'
|
||||
)
|
||||
|
||||
let planCode = subscription?.planCode
|
||||
if (!planCode && !userInNonIndividualSub) {
|
||||
planCode = 'personal'
|
||||
@@ -849,7 +843,6 @@ const _ProjectController = {
|
||||
customerIoEnabled,
|
||||
addonPrices,
|
||||
compileSettings: {
|
||||
reducedTimeoutWarning: reducedTimeoutWarning?.variant,
|
||||
compileTimeout: ownerFeatures?.compileTimeout,
|
||||
},
|
||||
})
|
||||
|
||||
+15
-35
@@ -15,42 +15,32 @@ function CompileTimeWarningUpgradePrompt() {
|
||||
const [dismissedUntilWarning, setDismissedUntilWarning] = usePersistedState<
|
||||
Date | undefined
|
||||
>(`has-dismissed-10s-compile-time-warning-until`)
|
||||
const { reducedTimeoutWarning } = getMeta('ol-compileSettings')
|
||||
const warningThreshold = reducedTimeoutWarning === 'enabled' ? 7 : 10
|
||||
|
||||
const sharedSegmentation = useMemo(
|
||||
() => ({
|
||||
'10s-timeout-warning': reducedTimeoutWarning,
|
||||
'is-owner': isProjectOwner,
|
||||
}),
|
||||
[isProjectOwner, reducedTimeoutWarning]
|
||||
)
|
||||
|
||||
const warningSegmentation = useMemo(
|
||||
() => ({
|
||||
content: 'warning',
|
||||
compileTime: warningThreshold,
|
||||
...sharedSegmentation,
|
||||
compileTime: 7,
|
||||
isProjectOwner,
|
||||
}),
|
||||
[sharedSegmentation, warningThreshold]
|
||||
[isProjectOwner]
|
||||
)
|
||||
|
||||
const changingSoonSegmentation = useMemo(
|
||||
() => ({
|
||||
content: 'changes',
|
||||
compileTime: 10,
|
||||
...sharedSegmentation,
|
||||
isProjectOwner,
|
||||
}),
|
||||
[sharedSegmentation]
|
||||
[isProjectOwner]
|
||||
)
|
||||
|
||||
const handleNewCompile = useCallback(
|
||||
(compileTime: number) => {
|
||||
setShowWarning(false)
|
||||
setShowChangingSoon(false)
|
||||
if (reducedTimeoutWarning === 'enabled' && compileTime > 10000) {
|
||||
if (compileTime > 10000) {
|
||||
setShowChangingSoon(true)
|
||||
} else if (compileTime > warningThreshold * 1000) {
|
||||
} else if (compileTime > 7000) {
|
||||
if (isProjectOwner) {
|
||||
if (
|
||||
!dismissedUntilWarning ||
|
||||
@@ -58,52 +48,42 @@ function CompileTimeWarningUpgradePrompt() {
|
||||
) {
|
||||
setShowWarning(true)
|
||||
eventTracking.sendMB('compile-time-warning-displayed', {
|
||||
compileTime: warningThreshold,
|
||||
compileTime: 7,
|
||||
isProjectOwner,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
[
|
||||
isProjectOwner,
|
||||
dismissedUntilWarning,
|
||||
reducedTimeoutWarning,
|
||||
warningThreshold,
|
||||
]
|
||||
[isProjectOwner, dismissedUntilWarning]
|
||||
)
|
||||
|
||||
const handleDismissWarning = useCallback(() => {
|
||||
eventTracking.sendMB('compile-time-warning-dismissed', {
|
||||
compileTime: warningThreshold,
|
||||
compileTime: 7,
|
||||
isProjectOwner,
|
||||
})
|
||||
eventTracking.sendMB('paywall-dismiss', {
|
||||
'paywall-type': 'compile-time-warning',
|
||||
content: 'warning',
|
||||
compileTime: warningThreshold,
|
||||
...sharedSegmentation,
|
||||
compileTime: 7,
|
||||
isProjectOwner,
|
||||
})
|
||||
setShowWarning(false)
|
||||
const until = new Date()
|
||||
until.setDate(until.getDate() + 1) // 1 day
|
||||
setDismissedUntilWarning(until)
|
||||
}, [
|
||||
isProjectOwner,
|
||||
setDismissedUntilWarning,
|
||||
warningThreshold,
|
||||
sharedSegmentation,
|
||||
])
|
||||
}, [isProjectOwner, setDismissedUntilWarning])
|
||||
|
||||
const handleDismissChangingSoon = useCallback(() => {
|
||||
eventTracking.sendMB('paywall-dismiss', {
|
||||
'paywall-type': 'compile-time-warning',
|
||||
compileTime: 10,
|
||||
content: 'changes',
|
||||
...sharedSegmentation,
|
||||
isProjectOwner,
|
||||
})
|
||||
setShowChangingSoon(false)
|
||||
}, [sharedSegmentation])
|
||||
}, [isProjectOwner])
|
||||
|
||||
useEffect(() => {
|
||||
if (compiling || error || showLogs) return
|
||||
|
||||
+10
-14
@@ -26,16 +26,14 @@ function TimeoutUpgradePromptNew() {
|
||||
setAnimateCompileDropdownArrow(true)
|
||||
}, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow])
|
||||
|
||||
const { reducedTimeoutWarning, compileTimeout } =
|
||||
getMeta('ol-compileSettings')
|
||||
const { compileTimeout } = getMeta('ol-compileSettings')
|
||||
|
||||
const sharedSegmentation = useMemo(
|
||||
() => ({
|
||||
'10s-timeout-warning': reducedTimeoutWarning,
|
||||
'is-owner': isProjectOwner,
|
||||
compileTime: compileTimeout,
|
||||
}),
|
||||
[isProjectOwner, reducedTimeoutWarning, compileTimeout]
|
||||
[isProjectOwner, compileTimeout]
|
||||
)
|
||||
|
||||
return (
|
||||
@@ -152,16 +150,14 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
|
||||
headerTitle={t('reasons_for_compile_timeouts')}
|
||||
formattedContent={
|
||||
<>
|
||||
{segmentation?.['10s-timeout-warning'] === 'enabled' && (
|
||||
<p>
|
||||
<em>
|
||||
<Trans
|
||||
i18nKey="were_reducing_compile_timeout"
|
||||
components={[compileTimeoutChangesBlogLink]}
|
||||
/>
|
||||
</em>
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
<em>
|
||||
<Trans
|
||||
i18nKey="were_reducing_compile_timeout"
|
||||
components={[compileTimeoutChangesBlogLink]}
|
||||
/>
|
||||
</em>
|
||||
</p>
|
||||
<p>{t('common_causes_of_compile_timeouts_include')}:</p>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -95,7 +95,6 @@ export interface Meta {
|
||||
'ol-cannot-use-ai': boolean
|
||||
'ol-capabilities': Array<'dropbox' | 'chat' | 'use-ai' | 'link-sharing'>
|
||||
'ol-compileSettings': {
|
||||
reducedTimeoutWarning: string
|
||||
compileTimeout: number
|
||||
}
|
||||
'ol-compilesUserContentDomain': string
|
||||
|
||||
@@ -9,7 +9,6 @@ describe('<PdfPreviewDetachedRoot/>', function () {
|
||||
window.metaAttributesCache.set('ol-projectName', 'Project Name')
|
||||
window.metaAttributesCache.set('ol-preventCompileOnLoad', true)
|
||||
window.metaAttributesCache.set('ol-compileSettings', {
|
||||
reducedWarningThreshold: 'default',
|
||||
compileTimeout: 240,
|
||||
})
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ describe('<PdfPreview/>', function () {
|
||||
})
|
||||
window.metaAttributesCache.set('ol-projectOwnerHasPremiumOnPageLoad', true)
|
||||
window.metaAttributesCache.set('ol-compileSettings', {
|
||||
reducedWarningThreshold: 'default',
|
||||
compileTimeout: 240,
|
||||
})
|
||||
cy.interceptEvents()
|
||||
|
||||
Reference in New Issue
Block a user