Skip to content

Commit

Permalink
fix(structure): issue where the document actions were showing discard…
Browse files Browse the repository at this point in the history
… version when they shouldnt
  • Loading branch information
RitaDias committed Oct 29, 2024
1 parent 7c412f8 commit 76894c1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ export const DocumentPaneProvider = memo((props: DocumentPaneProviderProps) => {
const getDocumentPerspective = useCallback(() => {
let version: DocumentActionsPerspective
switch (true) {
// bundle Perspective will always be undefined in published and draft but not on version
case typeof bundlePerspective !== 'undefined':
/**
* bundle Perspective will always be undefined in published and draft but not on version
* should also check if the current value is a version otherwise this would impact the document actions
*/
case typeof bundlePerspective !== 'undefined' && isVersionId(value._id):
version = 'version'
break
case Boolean(params):
Expand All @@ -174,7 +177,7 @@ export const DocumentPaneProvider = memo((props: DocumentPaneProviderProps) => {
}

return version
}, [bundlePerspective, params, perspective])
}, [bundlePerspective, params, perspective, value._id])

const actionsPerspective = useMemo(() => getDocumentPerspective(), [getDocumentPerspective])

Expand Down

0 comments on commit 76894c1

Please sign in to comment.