Skip to content

Commit d11221c

Browse files
Merge pull request #7448 from nextcloud/fix/workspace-race
fix(workspace): fix race condition when loading
2 parents afe3519 + 09e7f1d commit d11221c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/helpers/files.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export const addMenuRichWorkspace = () => {
192192

193193
let FilesHeaderRichWorkspaceView
194194
let FilesHeaderRichWorkspaceInstance
195+
let latestFolder
195196

196197
export const FilesWorkspaceHeader = new Header({
197198
id: 'workspace',
@@ -201,6 +202,7 @@ export const FilesWorkspaceHeader = new Header({
201202
return ['files', 'favorites', 'public-share'].includes(view.id)
202203
},
203204
render: async (el, folder) => {
205+
latestFolder = folder
204206
// Import the RichWorkspace component only when needed
205207
if (!FilesHeaderRichWorkspaceView) {
206208
FilesHeaderRichWorkspaceView = (
@@ -214,9 +216,9 @@ export const FilesWorkspaceHeader = new Header({
214216
console.debug('Destroying existing FilesHeaderRichWorkspaceInstance')
215217
}
216218

217-
const hasRichWorkspace = !!folder.attributes['rich-workspace-file']
218-
const content = folder.attributes['rich-workspace'] || ''
219-
const path = folder.path || ''
219+
const hasRichWorkspace = !!latestFolder.attributes['rich-workspace-file']
220+
const content = latestFolder.attributes['rich-workspace'] || ''
221+
const path = latestFolder.path || ''
220222

221223
// Create a new instance of the RichWorkspace component
222224
FilesHeaderRichWorkspaceInstance = new Vue({
@@ -232,6 +234,7 @@ export const FilesWorkspaceHeader = new Header({
232234
},
233235

234236
updated(folder) {
237+
latestFolder = folder
235238
if (!FilesHeaderRichWorkspaceInstance) {
236239
console.error('No vue instance found for FilesWorkspaceHeader')
237240
return

0 commit comments

Comments
 (0)