summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorGrigorii K. Shartsev <me@shgk.me>2023-10-31 18:59:38 +0500
committerGitHub <noreply@github.com>2023-10-31 18:59:38 +0500
commite9189e07953487e6bcd3c655c3271a05e9ebb298 (patch)
treeac8082f1b78bc6bac95285f0bf1fc977aeb0074e /apps
parente85f61639916d53d31f26677d224c05f9bfa5c32 (diff)
parentd439417e17bf7e6d62ca0dd62a51d531b90d7d73 (diff)
downloadnextcloud-server-e9189e07953487e6bcd3c655c3271a05e9ebb298.tar.gz
nextcloud-server-e9189e07953487e6bcd3c655c3271a05e9ebb298.zip
Merge pull request #41206 from nextcloud/fix/39565/race-condition-on-web-files-view
fix(files): race condition on web files view change
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/app.js6
-rw-r--r--apps/files/js/filelist.js7
-rw-r--r--apps/files/src/views/Navigation.vue12
3 files changed, 12 insertions, 13 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js
index d92d8f77287..1d1f87d5f5d 100644
--- a/apps/files/js/app.js
+++ b/apps/files/js/app.js
@@ -219,10 +219,12 @@
/**
* Sets the currently active view
* @param viewId view id
+ * @param {Object} options options
+ * @param {boolean} [options.silent=false] if true, the view will not be shown immediately
*/
- setActiveView: function(viewId) {
+ setActiveView: function (viewId, { silent = false } = {}) {
// The Navigation API will handle the final event
- window._nc_event_bus.emit('files:legacy-navigation:changed', { id: viewId })
+ window._nc_event_bus.emit('files:legacy-navigation:changed', { id: viewId, silent })
},
/**
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index af776cb8cd5..e3fe7608299 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -764,13 +764,6 @@
*/
_onShow: function(e) {
OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);
- if (e.itemId === this.id) {
- this._setCurrentDir('/', false);
- }
- // Only reload if we don't navigate to a different directory
- if (typeof e.dir === 'undefined' || e.dir === this.getCurrentDirectory()) {
- this.reload();
- }
},
/**
diff --git a/apps/files/src/views/Navigation.vue b/apps/files/src/views/Navigation.vue
index e164880003a..d4dbb7899aa 100644
--- a/apps/files/src/views/Navigation.vue
+++ b/apps/files/src/views/Navigation.vue
@@ -228,16 +228,20 @@ export default {
* Coming from the legacy files app.
* TODO: remove when all views are migrated.
*
- * @param {Navigation} view the new active view
+ * @param {object} payload the payload
+ * @param {string} [payload.id='files'] the view id
+ * @param {boolean} [payload.silent=false] if true, the view will not be shown immediately
*/
- onLegacyNavigationChanged({ id } = { id: 'files' }) {
+ onLegacyNavigationChanged({ id = 'files', silent = false } = {}) {
const view = this.Navigation.views.find(view => view.id === id)
if (view && view.legacy && view.id !== this.currentView.id) {
// Force update the current route as the request comes
// from the legacy files app router
this.$router.replace({ ...this.$route, params: { view: view.id } })
- this.Navigation.setActive(view)
- this.showView(view)
+ if (!silent) {
+ this.Navigation.setActive(view)
+ this.showView(view)
+ }
}
},