Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Avoid having multiple rich workspace instances active
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Nov 22, 2023
commit a5f1bab0ccef58fccd2896ce0bc978cdf2b99bb5
12 changes: 12 additions & 0 deletions src/helpers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,17 @@ export const FilesWorkspaceHeader = new Header({
},

render(el, folder, view) {
if (vm) {
// Enforce destroying of the old rendering and rerender as the FilesListHeader calls render on every folder change
vm.$destroy()
vm = null
}
const hasRichWorkspace = !!folder.attributes['rich-workspace-file'] || !!newWorkspaceCreated
const path = newWorkspaceCreated ? dirname(newWorkspaceCreated.path) : folder.path
const content = newWorkspaceCreated ? '' : folder.attributes['rich-workspace']

newWorkspaceCreated = false

import('vue').then((module) => {
el.id = 'files-workspace-wrapper'

Expand All @@ -239,6 +246,11 @@ export const FilesWorkspaceHeader = new Header({

updated(folder, view) {
newWorkspaceCreated = false

// Currently there is not much use in updating the vue instance props since render is called on every folder change
// removing the rendered element from the DOM
// This is only relevant if switching to a folder that has no content as then the render function is not called

const hasRichWorkspace = !!folder.attributes['rich-workspace-file']
vm.path = folder.path
vm.hasRichWorkspace = hasRichWorkspace
Expand Down