From 610b9995baf705857d0ab98db16c4fcaca7c5e15 Mon Sep 17 00:00:00 2001 From: Zack Stickles Date: Tue, 19 May 2020 11:32:29 -0700 Subject: [PATCH] fix: only add a url if one exists for a parent --- src/utils/create-breadcrumbs.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/create-breadcrumbs.js b/src/utils/create-breadcrumbs.js index 96452b129..3d6f0cc05 100644 --- a/src/utils/create-breadcrumbs.js +++ b/src/utils/create-breadcrumbs.js @@ -40,10 +40,11 @@ const createBreadcrumbs = (url, links, result = []) => { // if the crumbs are different, we found a valid match below this link if (crumbs !== result) { // get the details for this link without the children - const { url, displayName } = link; + let parentLink = { displayName: link.displayName }; + if (link.url) parentLink.url = link.url; // return the current crumbs, this link, and the crumbs found below - return [...acc, { url, displayName }, ...crumbs]; + return [...acc, parentLink, ...crumbs]; } else { // otherwise, this is an invalid branch, just return the result so far return acc;