Skip to content

Commit 9e480ec

Browse files
Merge pull request #7449 from nextcloud/backport/7448/stable31
[stable31] fix(workspace): fix race condition when loading
2 parents 6ec025d + 80016bb commit 9e480ec

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
@@ -164,6 +164,7 @@ export const addMenuRichWorkspace = () => {
164164

165165
let FilesHeaderRichWorkspaceView
166166
let FilesHeaderRichWorkspaceInstance
167+
let latestFolder
167168

168169
export const FilesWorkspaceHeader = new Header({
169170
id: 'workspace',
@@ -173,6 +174,7 @@ export const FilesWorkspaceHeader = new Header({
173174
return ['files', 'favorites', 'public-share'].includes(view.id)
174175
},
175176
render: async (el, folder) => {
177+
latestFolder = folder
176178
// Import the RichWorkspace component only when needed
177179
if (!FilesHeaderRichWorkspaceView) {
178180
FilesHeaderRichWorkspaceView = (
@@ -186,9 +188,9 @@ export const FilesWorkspaceHeader = new Header({
186188
console.debug('Destroying existing FilesHeaderRichWorkspaceInstance')
187189
}
188190

189-
const hasRichWorkspace = !!folder.attributes['rich-workspace-file']
190-
const content = folder.attributes['rich-workspace'] || ''
191-
const path = folder.path || ''
191+
const hasRichWorkspace = !!latestFolder.attributes['rich-workspace-file']
192+
const content = latestFolder.attributes['rich-workspace'] || ''
193+
const path = latestFolder.path || ''
192194

193195
// Create a new instance of the RichWorkspace component
194196
FilesHeaderRichWorkspaceInstance = new Vue({
@@ -205,6 +207,7 @@ export const FilesWorkspaceHeader = new Header({
205207
},
206208

207209
updated(folder) {
210+
latestFolder = folder
208211
if (!FilesHeaderRichWorkspaceInstance) {
209212
console.error('No vue instance found for FilesWorkspaceHeader')
210213
return

0 commit comments

Comments
 (0)