mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #28346 from overleaf/as-compile-timeout-teardown
[web] Teardown 10s-timeout-enforcement split test GitOrigin-RevId: 56b286539446e7dab371fb1c7392692cabb15db9
This commit is contained in:
+1
-1
@@ -95,7 +95,7 @@ export const ShortCompileTimeoutErrorState = () => {
|
||||
<p>
|
||||
<em>
|
||||
<Trans
|
||||
i18nKey="were_reducing_compile_timeout"
|
||||
i18nKey="weve_reduced_compile_timeout"
|
||||
components={[
|
||||
/* eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key */
|
||||
<a
|
||||
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
import Notification from '@/shared/components/notification'
|
||||
import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import * as eventTracking from '@/infrastructure/event-tracking'
|
||||
import { FC } from 'react'
|
||||
|
||||
export const CompileTimeoutChangingSoon: FC<{
|
||||
isProjectOwner?: boolean
|
||||
handleDismissChangingSoon: () => void
|
||||
segmentation?: eventTracking.Segmentation
|
||||
}> = ({ isProjectOwner = false, handleDismissChangingSoon, segmentation }) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const sendInfoClickEvent = () => {
|
||||
eventTracking.sendMB('paywall-info-click', {
|
||||
'paywall-type': 'compile-time-warning',
|
||||
...segmentation,
|
||||
content: 'blog',
|
||||
})
|
||||
}
|
||||
|
||||
const compileTimeoutChangesBlogLink = (
|
||||
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
||||
<a
|
||||
aria-label={t('read_more_about_compile_timeout_changes')}
|
||||
href="/blog/changes-to-free-compile-timeout"
|
||||
key="compileTimeoutBlogLink1"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
onClick={sendInfoClickEvent}
|
||||
/>
|
||||
)
|
||||
|
||||
const fixingCompileTimeoutsLearnLink = (
|
||||
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
||||
<a
|
||||
aria-label={t('read_more_about_fix_prevent_timeout')}
|
||||
href="/learn/how-to/Fixing_and_preventing_compile_timeouts"
|
||||
key="compileTimeoutBlogLink2"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
/>
|
||||
)
|
||||
|
||||
if (isProjectOwner) {
|
||||
return (
|
||||
<Notification
|
||||
action={
|
||||
<StartFreeTrialButton
|
||||
segmentation={segmentation}
|
||||
source="compile-time-warning"
|
||||
buttonProps={{
|
||||
variant: 'secondary',
|
||||
size: 'sm',
|
||||
}}
|
||||
>
|
||||
{t('start_free_trial_without_exclamation')}
|
||||
</StartFreeTrialButton>
|
||||
}
|
||||
ariaLive="polite"
|
||||
content={
|
||||
<div>
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="introducing_shorter_compile_timeout"
|
||||
components={[compileTimeoutChangesBlogLink]}
|
||||
/>
|
||||
</p>
|
||||
<p className="row-spaced">
|
||||
<Trans
|
||||
i18nKey="you_may_be_able_to_fix_issues_to_speed_up_the_compile"
|
||||
components={[fixingCompileTimeoutsLearnLink]}
|
||||
/>{' '}
|
||||
<Trans
|
||||
i18nKey="and_upgrade_for_compile_time"
|
||||
components={{ strong: <strong /> }}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
title={t('your_project_compiled_but_soon_might_not')}
|
||||
type="warning"
|
||||
isActionBelowContent
|
||||
isDismissible
|
||||
onDismiss={handleDismissChangingSoon}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Notification
|
||||
ariaLive="polite"
|
||||
content={
|
||||
<div>
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="introducing_shorter_compile_timeout"
|
||||
components={[compileTimeoutChangesBlogLink]}
|
||||
/>{' '}
|
||||
<Trans
|
||||
i18nKey="you_may_be_able_to_fix_issues_to_speed_up_the_compile"
|
||||
components={[fixingCompileTimeoutsLearnLink]}
|
||||
/>
|
||||
</p>
|
||||
<p className="row-spaced">
|
||||
<Trans
|
||||
i18nKey="tell_the_project_owner_and_ask_them_to_upgrade"
|
||||
components={[
|
||||
// eslint-disable-next-line react/jsx-key
|
||||
<strong />,
|
||||
]}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
title={t('this_project_compiled_but_soon_might_not')}
|
||||
type="warning"
|
||||
isDismissible
|
||||
onDismiss={handleDismissChangingSoon}
|
||||
/>
|
||||
)
|
||||
}
|
||||
+2
-33
@@ -4,14 +4,12 @@ import { useDetachCompileContext } from '@/shared/context/detach-compile-context
|
||||
import usePersistedState from '@/shared/hooks/use-persisted-state'
|
||||
import { CompileTimeWarningUpgradePromptInner } from '@/features/pdf-preview/components/compile-time-warning-upgrade-prompt-inner'
|
||||
import getMeta from '@/utils/meta'
|
||||
import { CompileTimeoutChangingSoon } from './compile-time-changing-soon'
|
||||
|
||||
function CompileTimeWarningUpgradePrompt() {
|
||||
const { isProjectOwner, deliveryLatencies, compiling, showLogs, error } =
|
||||
useDetachCompileContext()
|
||||
|
||||
const [showWarning, setShowWarning] = useState(false)
|
||||
const [showChangingSoon, setShowChangingSoon] = useState(false)
|
||||
const [dismissedUntilWarning, setDismissedUntilWarning] = usePersistedState<
|
||||
Date | undefined
|
||||
>(`has-dismissed-10s-compile-time-warning-until`)
|
||||
@@ -25,22 +23,10 @@ function CompileTimeWarningUpgradePrompt() {
|
||||
[isProjectOwner]
|
||||
)
|
||||
|
||||
const changingSoonSegmentation = useMemo(
|
||||
() => ({
|
||||
content: 'changes',
|
||||
compileTime: 10,
|
||||
isProjectOwner,
|
||||
}),
|
||||
[isProjectOwner]
|
||||
)
|
||||
|
||||
const handleNewCompile = useCallback(
|
||||
(compileTime: number) => {
|
||||
setShowWarning(false)
|
||||
setShowChangingSoon(false)
|
||||
if (compileTime > 10000) {
|
||||
setShowChangingSoon(true)
|
||||
} else if (compileTime > 7000) {
|
||||
if (compileTime > 7000) {
|
||||
if (isProjectOwner) {
|
||||
if (
|
||||
!dismissedUntilWarning ||
|
||||
@@ -75,16 +61,6 @@ function CompileTimeWarningUpgradePrompt() {
|
||||
setDismissedUntilWarning(until)
|
||||
}, [isProjectOwner, setDismissedUntilWarning])
|
||||
|
||||
const handleDismissChangingSoon = useCallback(() => {
|
||||
eventTracking.sendMB('paywall-dismiss', {
|
||||
'paywall-type': 'compile-time-warning',
|
||||
compileTime: 10,
|
||||
content: 'changes',
|
||||
isProjectOwner,
|
||||
})
|
||||
setShowChangingSoon(false)
|
||||
}, [isProjectOwner])
|
||||
|
||||
useEffect(() => {
|
||||
if (compiling || error || showLogs) return
|
||||
handleNewCompile(deliveryLatencies.compileTimeServerE2E)
|
||||
@@ -103,7 +79,7 @@ function CompileTimeWarningUpgradePrompt() {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!showWarning && !showChangingSoon) {
|
||||
if (!showWarning) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -115,13 +91,6 @@ function CompileTimeWarningUpgradePrompt() {
|
||||
segmentation={warningSegmentation}
|
||||
/>
|
||||
)}
|
||||
{showChangingSoon && (
|
||||
<CompileTimeoutChangingSoon
|
||||
isProjectOwner={isProjectOwner}
|
||||
handleDismissChangingSoon={handleDismissChangingSoon}
|
||||
segmentation={changingSoonSegmentation}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
|
||||
<p>
|
||||
<em>
|
||||
<Trans
|
||||
i18nKey="were_reducing_compile_timeout"
|
||||
i18nKey="weve_reduced_compile_timeout"
|
||||
components={[compileTimeoutChangesBlogLink]}
|
||||
/>
|
||||
</em>
|
||||
|
||||
Reference in New Issue
Block a user