Skip to content

Commit

Permalink
Fix add mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Oct 21, 2024
1 parent 2cb30f8 commit 039fbaa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/volto-slate-glossary/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const MY_NAMESPACE = '4549d0a3-5fc2-4a94-bf96-eb7ddf5363a4';
export const TextWithGlossaryTooltips = ({ text }) => {
// Read jotai atom and return value with the appropriate key.
const tooltippedTexts = useAtomValue(tooltippedTextsAtom);
const location = useSelector((state) => state.router.location);

const location = useSelector((state) => state.router?.location);

// No tooltips if user opted out
const currentuser = useSelector((state) => state.users?.user);
Expand All @@ -17,10 +18,12 @@ export const TextWithGlossaryTooltips = ({ text }) => {
return text;
}

// No tooltips in edit and add mode
// No tooltips on home page, in edit mode, and add mode
if (location === undefined) {
return text;
}
const isEditMode = location.pathname.slice(-5) === '/edit';
const isAddMode = location.pathname.slice(-4) === '/add';
if (isEditMode || isAddMode || location.pathname === '/' || !__CLIENT__) {
if (isEditMode || location.pathname === '/' || !__CLIENT__) {
return text;
}

Expand Down

0 comments on commit 039fbaa

Please sign in to comment.