Skip to content

Commit

Permalink
feat(sanity): ensure only final restore action is used
Browse files Browse the repository at this point in the history
  • Loading branch information
juice49 committed May 14, 2024
1 parent 071d9f6 commit 3e3c5c6
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ export const HistoryStatusBarActions = memo(function HistoryStatusBarActions() {
const revision = revTime?.id || ''
const disabled = (editState?.draft || editState?.published || {})._rev === revision
const actionProps = useMemo(() => ({...(editState || {}), revision}), [editState, revision])
const historyActions = useMemo(() => (actions ?? []).filter(isRestoreAction), [actions])

// If multiple `restore` actions are defined, ensure only the final one is used.
const historyActions = useMemo(() => (actions ?? []).filter(isRestoreAction).slice(-1), [actions])

return (
<RenderActionCollectionState
Expand Down

0 comments on commit 3e3c5c6

Please sign in to comment.