mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 23:24:07 -05:00
Fix load metadata (#16417)
GitOrigin-RevId: 26505e08ca9074238253dba08d0380422ae859be
This commit is contained in:
parent
e27abe56b8
commit
e91b76a4f0
1 changed files with 8 additions and 8 deletions
|
@ -184,6 +184,12 @@ export const MetadataProvider: FC = ({ children }) => {
|
||||||
|
|
||||||
useEventListener('editor:metadata-outdated', handleMetadataOutdated)
|
useEventListener('editor:metadata-outdated', handleMetadataOutdated)
|
||||||
|
|
||||||
|
const permissionsRef = useRef(permissions)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
permissionsRef.current = permissions
|
||||||
|
}, [permissions])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleProjectJoined = ({
|
const handleProjectJoined = ({
|
||||||
detail: [{ project }],
|
detail: [{ project }],
|
||||||
|
@ -195,7 +201,7 @@ export const MetadataProvider: FC = ({ children }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
if (permissions.write) {
|
if (permissionsRef.current.write) {
|
||||||
loadProjectMetaFromServer()
|
loadProjectMetaFromServer()
|
||||||
}
|
}
|
||||||
}, 200)
|
}, 200)
|
||||||
|
@ -206,13 +212,7 @@ export const MetadataProvider: FC = ({ children }) => {
|
||||||
return () => {
|
return () => {
|
||||||
eventEmitter.off('project:joined', handleProjectJoined)
|
eventEmitter.off('project:joined', handleProjectJoined)
|
||||||
}
|
}
|
||||||
}, [
|
}, [eventEmitter, loadProjectMetaFromServer, showGenericMessageModal, t])
|
||||||
eventEmitter,
|
|
||||||
loadProjectMetaFromServer,
|
|
||||||
permissions,
|
|
||||||
showGenericMessageModal,
|
|
||||||
t,
|
|
||||||
])
|
|
||||||
|
|
||||||
const value = useMemo<MetadataContextValue>(
|
const value = useMemo<MetadataContextValue>(
|
||||||
() => ({
|
() => ({
|
||||||
|
|
Loading…
Reference in a new issue