remix-run / blues-stack

The Remix Stack for deploying to Fly with PostgreSQL, authentication, testing, linting, formatting, etc.
https://remix.run/stacks
MIT License
943 stars 231 forks source link

Latest server.js code breaks HDR #224

Closed paulhmorris closed 9 months ago

paulhmorris commented 10 months ago

Have you experienced this bug with the latest version of the template?

Yes

Steps to Reproduce

npx create-remix@latest --template remix-run/blues-stack
npm run build
npm run dev

In root.tsx, log anything in the loader to trigger HDR

export const loader = async ({ request }: LoaderFunctionArgs) => {
  const data = {
    foo: "bar",
    foo2: "bar2",
  };
  console.log(data);
  return json({ user: await getUser(request) });
};
// Logs nothing on HDR

Nothing is logged. Stop the dev process and restart --> now the data is logged.

Comment out a line of the object and save

const data = {
    foo: "bar",
    // foo2: "bar2",
  };
console.log(data);
// still logs { foo: 'bar', foo2: 'bar2' } from previous file state

The updated object is not logged. The console indicated that hmr + hdr ran. Even declaring the object outside the loader doesn't resolve it.


Using the server.ts from before #221 resolves the issue, but I don't know enough about what's going on to give any more helpful info.

Thanks!

Expected Behavior

Changing code inside loaders or used inside loaders should rerun loaders with new code.

Actual Behavior

Changing code inside loaders or used inside loaders does not rerun loaders with new code, and a full server restart is required to see changes.

lou commented 9 months ago

I had the same issue, and https://github.com/remix-run/blues-stack/pull/222 fixed it.