Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
fix navigationBlock View
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed Feb 2, 2022
1 parent 874c0d7 commit ee0891a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/components/manage/Blocks/NavigationBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ const View = ({ content, ...props }) => {
const isLoggedIn = cookie.load('auth_token');

const parent =
data?.navFromParent?.value && props.properties?.parent
data?.navFromParent && props.properties?.parent
? getBasePath(props.properties?.parent?.['@id'])
: data.parent?.value;
: data.parent;
const history = useHistory();
useEffect(() => {
const pagesProperties = data.pages?.value
? data.pages?.value?.properties || {}
: {};
const pagesProperties = data.pages ? data.pages?.properties || {} : {};
const newPages =
Object.keys(pagesProperties).map((page) => pagesProperties[page]) || [];
setPages(newPages);
Expand All @@ -49,7 +47,7 @@ const View = ({ content, ...props }) => {
setIsMobile(false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.navigation, data.pages?.value]);
}, [props.navigation, data.pages]);

const isFixed = props.fixedTabs;

Expand Down Expand Up @@ -82,9 +80,7 @@ const View = ({ content, ...props }) => {
props.navigation?.items?.length ||
pages.length
}
className={
props.data.className?.value ? props.data.className.value : ''
}
className={props.data.className || ''}
>
{isMobile ? (
<React.Fragment>
Expand Down Expand Up @@ -235,13 +231,13 @@ export default compose(
discodata_resources: state.discodata_resources,
navItems: state.navigation?.items,
flags: state.flags,
fixedTabs: props.data?.fixedTabs?.value,
fixedTabs: props.data?.fixedTabs,
navigation: props.properties?.parent
? getNavigationByParent(
state.navigation?.items,
props.data?.navFromParent?.value
props.data?.navFromParent
? getBasePath(props.properties?.parent?.['@id'])
: props.data?.parent?.value,
: props.data?.parent,
)
: {},
}),
Expand Down

0 comments on commit ee0891a

Please sign in to comment.