diff --git a/apps/storefront/src/components/layout/B3Nav.tsx b/apps/storefront/src/components/layout/B3Nav.tsx index 76ab5da9..b67ab42f 100644 --- a/apps/storefront/src/components/layout/B3Nav.tsx +++ b/apps/storefront/src/components/layout/B3Nav.tsx @@ -7,7 +7,6 @@ import { import { useContext, - useRef, } from 'react' import { useNavigate, @@ -29,6 +28,10 @@ import { GlobaledContext, } from '@/shared/global' +import { + B3SStorage, +} from '@/utils' + // import { // NavMessage, // } from './styled' @@ -43,7 +46,6 @@ export const B3Nav = ({ const [isMobile] = useMobile() const navigate = useNavigate() const location = useLocation() - const nextPath = useRef(null) const { state: globalState, @@ -68,14 +70,16 @@ export const B3Nav = ({ borderRadius: '4px', } if (location.pathname === path) { - nextPath.current = path + B3SStorage.set('nextPath', path) return activeStyle } - if (nextPath.current === path && location.pathname.includes('orderDetail')) { - return activeStyle + + if (location.pathname.includes('orderDetail')) { + const gotoOrderPath = B3SStorage.get('nextPath') === '/company-orders' ? '/company-orders' : '/orders' + if (path === gotoOrderPath) return activeStyle } - if (nextPath.current === path && location.pathname.includes('shoppingList')) { + if (location.pathname.includes('shoppingList') && path === '/shoppingLists') { return activeStyle } diff --git a/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx b/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx index 2530a212..e3e6be58 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx @@ -315,16 +315,19 @@ export const ChooseOptionsDialog = (props: ChooseOptionsDialogProps) => { quantity: parseInt(quantity.toString(), 10) || 1, variantId: parseInt(variantId.toString(), 10) || 1, }]) - - reset() })() } const handleCancelClicked = () => { - reset() onCancel() } + useEffect(() => { + if (!isOpen) { + reset() + } + }, [isOpen]) + return (