From 95fed6af127876b578b374c631aecc7677726e3b Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Mon, 16 Oct 2023 17:35:59 -0400 Subject: [PATCH] place route updates in manifest.routes, not manifest itself fixes useloaderdata destructuring when adding a loader to a route during HMR ``` TypeError: Cannot destructure property 'blah' of `useLoaderData(...)` as it is null. ``` Co-authored-by: Matt Brophy --- packages/remix-dev/vite/static/refresh-utils.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/remix-dev/vite/static/refresh-utils.cjs b/packages/remix-dev/vite/static/refresh-utils.cjs index aea8fcb335f..8a1c0d44732 100644 --- a/packages/remix-dev/vite/static/refresh-utils.cjs +++ b/packages/remix-dev/vite/static/refresh-utils.cjs @@ -16,7 +16,7 @@ const enqueueUpdate = debounce(async () => { manifest = JSON.parse(JSON.stringify(__remixManifest)); routeUpdates.forEach(async (route) => { - manifest[route.id] = route; + manifest.routes[route.id] = route; let imported = await __hmr_import(route.url + "?t=" + Date.now()); let routeModule = {