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:
Philip Molares
2026-04-29 21:39:17 +02:00
committed by Philip Molares
parent 6b226a0f7a
commit 1a56e3ad15
@@ -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])