fix recipe ig post can't load problem
This commit is contained in:
@@ -82,19 +82,29 @@ function Header({ showMenu = false }: HeaderProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
router.navigate({
|
||||
to: '/',
|
||||
hash: targetId,
|
||||
replace: location.pathname === '/',
|
||||
});
|
||||
if (typeof window !== 'undefined') {
|
||||
window.sessionStorage.setItem('pendingScrollSection', targetId);
|
||||
window.dispatchEvent(new CustomEvent('pending-scroll-section'));
|
||||
}
|
||||
|
||||
if (!isOnMainPage) {
|
||||
router.navigate({ to: '/' });
|
||||
}
|
||||
};
|
||||
|
||||
const handleMenuClick = (itemId: string) => {
|
||||
if (itemId === 'recipes') {
|
||||
router.navigate({
|
||||
to: '/recipe',
|
||||
replace: location.pathname === '/recipe',
|
||||
});
|
||||
const isOnRecipePage = location.pathname === '/recipe';
|
||||
|
||||
if (isOnRecipePage) {
|
||||
// Already on recipe page, just close drawer
|
||||
setIsDrawerOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Navigate from main page - force reload to ensure Instagram embeds work
|
||||
window.location.href = '/recipe';
|
||||
return;
|
||||
} else {
|
||||
scrollToSection(itemId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user