Merge pull request #4042 from overleaf/as-prevent-set-title

Prevent setting title on every render

GitOrigin-RevId: d9e5ad7d7a23099f153686f538ab3e733b3b7b07
This commit is contained in:
Jessica Lawshe 2021-05-18 08:43:41 -05:00 committed by Copybot
parent fefb588d71
commit 2abc9fa0e8

View file

@ -1,4 +1,4 @@
import React, { createContext, useCallback, useContext } from 'react'
import React, { createContext, useCallback, useContext, useEffect } from 'react'
import PropTypes from 'prop-types'
import useScopeValue from './util/scope-value-hook'
import { useApplicationContext } from './application-context'
@ -98,9 +98,11 @@ export function EditorProvider({ children, ide, settings }) {
)
const { setTitle } = useBrowserWindow()
setTitle(
`${projectName ? projectName + ' - ' : ''}Online LaTeX Editor ${appName}`
)
useEffect(() => {
setTitle(
`${projectName ? projectName + ' - ' : ''}Online LaTeX Editor ${appName}`
)
}, [appName, projectName, setTitle])
const editorContextValue = {
cobranding,