Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General fixes #252

Merged
merged 2 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion templates/demo-store/app/components/CountrySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export function CountrySelector() {
triggerOnce: true,
});

const observerRef = useRef(null);
useEffect(() => {
ref(observerRef.current);
}, [ref, observerRef]);

// Get available countries list when in view
useEffect(() => {
if (!inView || fetcher.data || fetcher.state === 'loading') return;
Expand All @@ -40,7 +45,7 @@ export function CountrySelector() {

return (
<section
ref={ref}
ref={observerRef}
className="grid gap-4 w-full md:max-w-[335px] md:ml-auto"
onMouseLeave={closeDropdown}
>
Expand Down
3 changes: 2 additions & 1 deletion templates/demo-store/app/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function Hero({
>
<div className="absolute inset-0 grid flex-grow grid-flow-col pointer-events-none auto-cols-fr -z-10 content-stretch overflow-clip">
{spread?.reference && (
<div className="">
<div>
<SpreadMedia
scale={2}
sizes={
Expand Down Expand Up @@ -110,6 +110,7 @@ function SpreadMedia({
return (
<MediaFile
data={data}
alt={data.alt}
className="block object-cover w-full h-full"
// @ts-expect-error Need to update the types in H-UI to allow optional properties on this object
mediaOptions={{
Expand Down
17 changes: 9 additions & 8 deletions templates/demo-store/app/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,15 @@ function FooterMenu({menu}: {menu?: EnhancedMenu}) {
open ? `max-h-48 h-fit` : `max-h-0 md:max-h-fit`
} overflow-hidden transition-all duration-300`}
>
{/* @todo: the `static` prop causes a Suspense warning */}
<Disclosure.Panel static>
<nav className={styles.nav}>
{item.items.map((subItem) => (
<FooterLink key={subItem.id} item={subItem} />
))}
</nav>
</Disclosure.Panel>
<Suspense data-comment="This suspense fixes a hydration bug in Disclosure.Panel with static prop">
<Disclosure.Panel static>
<nav className={styles.nav}>
{item.items.map((subItem) => (
<FooterLink key={subItem.id} item={subItem} />
))}
</nav>
</Disclosure.Panel>
</Suspense>
</div>
) : null}
</>
Expand Down