/**
* 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 })
},
/**
* 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)
+ }
}
},