Skip to content

Commit

Permalink
Merge pull request #5335 from nextcloud/fix/duplicate-loading-of-work…
Browse files Browse the repository at this point in the history
…space

fix: only register workspace once
  • Loading branch information
max-nextcloud authored Feb 6, 2024
2 parents 3453645 + 51064d9 commit 8cc511b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 9 additions & 0 deletions cypress/e2e/workspace.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ describe('Workspace', function() {
cy.createTestFolder().as('testFolder')
})

it('Initializes the workspace without errors', function() {
cy.visitTestFolder({
onBeforeLoad: win => cy.spy(win.console, 'error').as('consoleError'),
})
cy.then(() => {
expect(this.consoleError).to.not.have.been.calledWithMatch('workspace')
})
})

it('Hides the workspace when switching to another folder', function() {
cy.uploadFile('test.md', 'text/markdown', `${this.testFolder}/README.md`)
cy.createFolder(`${this.testFolder}/subdirectory`)
Expand Down
6 changes: 0 additions & 6 deletions src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
import { linkTo } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
import { registerFileListHeaders } from '@nextcloud/files'

import { logger } from './helpers/logger.js'

Expand Down Expand Up @@ -55,11 +54,6 @@ document.addEventListener('DOMContentLoaded', async () => {
el: () => { return el },
}))
}

if (workspaceAvailable) {
const { FilesWorkspaceHeader } = await import('./helpers/files.js')
registerFileListHeaders(FilesWorkspaceHeader)
}
})

OCA.Text = {
Expand Down

0 comments on commit 8cc511b

Please sign in to comment.