Merge pull request #3650 from overleaf/ta-file-tree-new-doc-listener-fix

Prevent Multiple Listeners on FileTreeReactBridge

GitOrigin-RevId: 49a09238156472f6cf18eafbf628a0443e9214a9
This commit is contained in:
Timothée Alby 2021-02-18 12:46:18 +01:00 committed by Copybot
parent 6e8a4e70dd
commit 8d3bb116d8

View file

@ -76,7 +76,11 @@ App.controller('FileTreeController', function($scope, $modal, ide, $rootScope) {
}
})
if (window.showReactFileTree) {
if (
window.showReactFileTree &&
!window.FileTreeReactBridgeOpenNewDocModalListened
) {
window.FileTreeReactBridgeOpenNewDocModalListened = true
window.addEventListener(
'FileTreeReactBridge.openNewDocModal',
({ detail }) => {
@ -203,7 +207,11 @@ App.controller('NewFileModalController', function(
$modalInstance.dismiss('done')
})
if (window.showReactFileTree) {
if (
window.showReactFileTree &&
!window.FileTreeReactBridgeOpenNewFileModalListened
) {
window.FileTreeReactBridgeOpenNewFileModalListened = true
window.addEventListener(
'FileTreeReactBridge.openNewFileModal',
({ detail }) => {