Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
glo11372 committed May 30, 2024
1 parent 0c63b30 commit 522ad03
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment, useMemo } from 'react';
import React, { Fragment, useMemo, useEffect, useRef, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { string } from 'prop-types';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -31,7 +31,18 @@ const Breadcrumbs = props => {
normalizedData,
handleClick
} = talonProps;

// console.log('currentCategoryPath', currentCategoryPath);
// console.log('currentCategory', currentCategory);
const [prevCategoryPath, setOldCategoryPath] = useState(currentCategoryPath);
console.log('currentCategoryPath', currentCategoryPath);
const oldCategoryPath = useRef(currentCategoryPath);
useEffect(() => {
oldCategoryPath.current = prevCategoryPath;
console.log('oldCategoryPath.current', oldCategoryPath.current);
setOldCategoryPath(currentCategoryPath)
}, [currentCategoryPath]);
// console.log( 'oldCategoryPath.current', oldCategoryPath.current);
// console.log( 'currentCategoryPath', currentCategoryPath);
// For all links generate a fragment like "/ Text"
const links = useMemo(() => {
return normalizedData.map(({ text, path }) => {
Expand Down Expand Up @@ -68,6 +79,8 @@ const Breadcrumbs = props => {
// If we have a "currentProduct" it means we're on a PDP so we want the last
// category text to be a link. If we don't have a "currentProduct" we're on
// a category page so it should be regular text.
//get store old CategoryPath
console.log('oldCategoryPath.current=====', oldCategoryPath.current);
const currentCategoryLink = currentProduct ? (
<Link
className={classes.link}
Expand All @@ -77,6 +90,7 @@ const Breadcrumbs = props => {
{currentCategory}
</Link>
) : (

<span className={classes.currentCategory}>{currentCategory}</span>
);

Expand Down

0 comments on commit 522ad03

Please sign in to comment.