Skip to content

Commit

Permalink
fix: only register workspace once
Browse files Browse the repository at this point in the history
Fixes #5332.

Looks like #4698 brought back the file list header initialization
that had just been moved to an init script in #4776.

Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
max-nextcloud authored and backportbot[bot] committed Feb 6, 2024
1 parent 4c8d727 commit b358266
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 b358266

Please sign in to comment.