mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2026-06-23 04:10:17 +00:00
fix(editor): use setNotePinStatus instead of setPinnedState
This method updates the backend and changes the redux state in one call, instead of just calling the backend. With this the state get's updated, and the user see that they pinned a note immediately. Fixes #6484 Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
committed by
Philip Molares
parent
6b226a0f7a
commit
1a56e3ad15
+2
-2
@@ -14,7 +14,7 @@ import { Pin as IconPin } from 'react-bootstrap-icons'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { WaitSpinner } from '../../../../common/wait-spinner/wait-spinner'
|
||||
import { useUiNotifications } from '../../../../notifications/ui-notification-boundary'
|
||||
import { setPinnedState } from '../../../../../api/explore'
|
||||
import { setNotePinStatus } from '../../../../../redux/pinned-notes/methods'
|
||||
|
||||
/**
|
||||
* Sidebar entry button that toggles the pinned status of the current note in the history.
|
||||
@@ -34,7 +34,7 @@ export const PinNoteSidebarEntry: React.FC<SpecificSidebarEntryProps> = ({ class
|
||||
return
|
||||
}
|
||||
setLoading(true)
|
||||
setPinnedState(noteAlias, !isPinned)
|
||||
setNotePinStatus(noteAlias, !isPinned)
|
||||
.catch(showErrorNotificationBuilder(`explore.pinnedNotes.${isPinned ? 'un' : ''}pinError`, { alias: noteAlias }))
|
||||
.finally(() => setLoading(false))
|
||||
}, [noteAlias, isPinned, showErrorNotificationBuilder])
|
||||
|
||||
Reference in New Issue
Block a user