Merge pull request #10793 from overleaf/mj-split-test-cleanup

Split test clean-up

GitOrigin-RevId: 7dd6178487022cbefcbc85797dacc3f3fbfa17e2
This commit is contained in:
Mathias Jakobsen
2022-12-21 09:04:04 +00:00
committed by Copybot
parent f6c1e2738d
commit 38cc3394e3
27 changed files with 53 additions and 622 deletions
@@ -27,8 +27,8 @@ import { useIdeContext } from './ide-context'
import { useProjectContext } from './project-context'
import { useEditorContext } from './editor-context'
import { buildFileList } from '../../features/pdf-preview/util/file-list'
import { useSplitTestContext } from './split-test-context'
import { useLayoutContext } from './layout-context'
import { useUserContext } from './user-context'
export const LocalCompileContext = createContext()
@@ -86,10 +86,10 @@ export function LocalCompileProvider({ children }) {
const { _id: projectId, rootDocId } = useProjectContext()
const { splitTestVariants } = useSplitTestContext()
const { pdfPreviewOpen } = useLayoutContext()
const { features } = useUserContext()
// whether a compile is in progress
const [compiling, setCompiling] = useState(false)
@@ -279,8 +279,7 @@ export function LocalCompileProvider({ children }) {
}, [compiledOnce, currentDoc, compiler])
useEffect(() => {
const compileTimeWarningEnabled =
splitTestVariants['compile-time-warning'] === 'show-upgrade-prompt'
const compileTimeWarningEnabled = features?.compileTimeout <= 60
if (compileTimeWarningEnabled && compiling && isProjectOwner) {
const timeout = window.setTimeout(() => {
@@ -291,7 +290,7 @@ export function LocalCompileProvider({ children }) {
window.clearTimeout(timeout)
}
}
}, [compiling, isProjectOwner, splitTestVariants])
}, [compiling, isProjectOwner, features])
// handle the data returned from a compile request
// note: this should _only_ run when `data` changes,
@@ -22,6 +22,7 @@ UserContext.Provider.propTypes = {
mendeley: PropTypes.boolean,
zotero: PropTypes.boolean,
references: PropTypes.boolean,
compileTimeout: PropTypes.number,
}),
refProviders: PropTypes.shape({
mendeley: PropTypes.any,