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 committed Feb 2, 2024
1 parent d2fe6a0 commit 51064d9
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 51064d9

Please sign in to comment.