mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -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)
|
||||
|
||||
const permissionsRef = useRef(permissions)
|
||||
|
||||
useEffect(() => {
|
||||
permissionsRef.current = permissions
|
||||
}, [permissions])
|
||||
|
||||
useEffect(() => {
|
||||
const handleProjectJoined = ({
|
||||
detail: [{ project }],
|
||||
|
@ -195,7 +201,7 @@ export const MetadataProvider: FC = ({ children }) => {
|
|||
)
|
||||
}
|
||||
window.setTimeout(() => {
|
||||
if (permissions.write) {
|
||||
if (permissionsRef.current.write) {
|
||||
loadProjectMetaFromServer()
|
||||
}
|
||||
}, 200)
|
||||
|
@ -206,13 +212,7 @@ export const MetadataProvider: FC = ({ children }) => {
|
|||
return () => {
|
||||
eventEmitter.off('project:joined', handleProjectJoined)
|
||||
}
|
||||
}, [
|
||||
eventEmitter,
|
||||
loadProjectMetaFromServer,
|
||||
permissions,
|
||||
showGenericMessageModal,
|
||||
t,
|
||||
])
|
||||
}, [eventEmitter, loadProjectMetaFromServer, showGenericMessageModal, t])
|
||||
|
||||
const value = useMemo<MetadataContextValue>(
|
||||
() => ({
|
||||
|
|
Loading…
Reference in a new issue