Skip to content

Commit

Permalink
Fix [Breadcrumbs] malfunctioning if the project name matches the page…
Browse files Browse the repository at this point in the history
… name (#2208)
  • Loading branch information
Taras-Hlukhovetskyi authored and ilan7empest committed Jan 21, 2024
1 parent 14a20a0 commit ad44cbe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common/Breadcrumbs/Breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ const Breadcrumbs = ({ onClick, projectStore, fetchProjectsNames }) => {
}, [projectStore.projectsNames.data])

const urlItems = useMemo(() => {
const pathItems = location.pathname.split('/').slice(1, 4)
const screen = projectScreens.find(screen => pathItems.find(pathItem => pathItem === screen.id))
const [projects, projectName, screenName] = location.pathname.split('/').slice(1, 4)
const screen = projectScreens.find(screen => screen.id === screenName)
const tab = projectTabs.find(tab =>
location.pathname.split('/').find(pathItem => pathItem === tab.id)
location.pathname.split('/').slice(3).find(pathItem => pathItem === tab.id)
)

return {
pathItems: pathItems.map(pathItem => (pathItem === screen?.id ? screen.label : pathItem)),
pathItems: [projects, projectName, screen?.label || screenName],
screen,
tab
}
Expand Down

0 comments on commit ad44cbe

Please sign in to comment.