hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

Hydrogen Perf Changes

Open blittle opened this issue 3 years ago • 1 comments

There are a number of performance improvements we should make to improve the default performance of Hydrogen apps, including:

  • [x] #1477
  • [ ] #1478
  • [ ] #1479
  • [x] #1480
  • [ ] #1481

blittle avatar Jun 08 '22 14:06 blittle

FYI, tracking these changes here: @developit @surma

blittle avatar Jun 08 '22 16:06 blittle

Just confirmed and reproduced this myself. The issue seems to be with the defer and json functions from @shopify/remix-oxygen.

Screenshot 2023-11-03 at 12 35 16 am

It seems to think that the actual object is under data.data which is wrong.

AdiRishi avatar Nov 02 '23 13:11 AdiRishi

Also confirming exact same issue.

You can repro the issue with the following:

  1. npm create @shopify/hydrogen@latest
  2. Paste this into a route:
import { useLoaderData } from '@remix-run/react';
import { defer } from '@shopify/remix-oxygen';

export const loader = async () => {
  return defer({ test: "test" });
};

export default function Index() {
  const data = useLoaderData<typeof loader>();

  return (
    <div>{data.test}</div>
  )
}
  1. Observe type error:
Property 'test' does not exist on type 'JsonifyObject<Pick<DeferredData, "init"> & { data: { test: string; }; readonly [typedDeferredDataBrand]: "TypedDeferredData"; }>'.

justinmetros avatar Nov 02 '23 14:11 justinmetros

I'm looking into this, and I think it's because @remix-run/server-runtime was not properly moved to be a peer dep of @shopify/remix-oxygen

blittle avatar Nov 02 '23 14:11 blittle

This is now fixed with @shopify/remix-oxygen v2.0.1.

blittle avatar Nov 02 '23 16:11 blittle

I apologize, but the fix also requires updating to @shopify/[email protected]

blittle avatar Nov 02 '23 16:11 blittle