diff --git a/frontend/cypress/e2e/deleteNote.spec.ts b/frontend/cypress/e2e/deleteNote.spec.ts index bc81a5137..37c521781 100644 --- a/frontend/cypress/e2e/deleteNote.spec.ts +++ b/frontend/cypress/e2e/deleteNote.spec.ts @@ -16,7 +16,7 @@ describe('Delete note', () => { }) cy.getByCypressId('sidebar.deleteNote.button').click() cy.getByCypressId('sidebar.deleteNote.modal').should('be.visible') - cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', '') + cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', 'Untitled') cy.getByCypressId('deletionModal.confirmButton').should('be.visible').click() cy.getByCypressId('sidebar.deleteNote.modal').should('not.be.exist') cy.getByCypressId('notification-toast').should('not.exist') @@ -28,7 +28,7 @@ describe('Delete note', () => { }) cy.getByCypressId('sidebar.deleteNote.button').click() cy.getByCypressId('sidebar.deleteNote.modal').should('be.visible') - cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', '') + cy.getByCypressId('sidebar.deleteNote.modal.noteTitle').should('be.visible').text().should('eq', 'Untitled') cy.getByCypressId('deletionModal.confirmButton').should('be.visible').click() cy.getByCypressId('sidebar.deleteNote.modal').should('not.exist') cy.getByCypressId('notification-toast').should('be.visible') diff --git a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts index 992801c9f..7b09df5b1 100644 --- a/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts +++ b/frontend/src/components/editor-page/editor-pane/hooks/yjs/use-on-note-deleted.ts @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { useApplicationState } from '../../../../../hooks/common/use-application-state' +import { useNoteTitle } from '../../../../../hooks/common/use-note-title' import { Logger } from '../../../../../utils/logger' import { useUiNotifications } from '../../../../notifications/ui-notification-boundary' import type { MessageTransporter } from '@hedgedoc/commons' @@ -21,7 +21,7 @@ const logger = new Logger('UseOnNoteDeleted') */ export const useOnNoteDeleted = (websocketConnection: MessageTransporter): void => { const router = useRouter() - const noteTitle = useApplicationState((state) => state.noteDetails.title) + const noteTitle = useNoteTitle() const { dispatchUiNotification } = useUiNotifications() const noteDeletedHandler = useCallback(() => { diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/delete-note-sidebar-entry/delete-note-modal.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/delete-note-sidebar-entry/delete-note-modal.tsx index 80092ccd5..bd49623b3 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/delete-note-sidebar-entry/delete-note-modal.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/delete-note-sidebar-entry/delete-note-modal.tsx @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { useApplicationState } from '../../../../../hooks/common/use-application-state' +import { useNoteTitle } from '../../../../../hooks/common/use-note-title' import { cypressId } from '../../../../../utils/cypress-attribute' import type { ModalVisibilityProps } from '../../../../common/modals/common-modal' import { DeletionModal } from '../../../../common/modals/deletion-modal' @@ -44,7 +44,7 @@ export const DeleteNoteModal: React.FC { - const noteTitle = useApplicationState((state) => state.noteDetails.title) + const noteTitle = useNoteTitle() return (