Bugfix: update stale HMR after fixed errors

This commit is contained in:
2026-07-20 20:54:39 +01:00
parent e3a0f5fbeb
commit a9cd51d71c
14 changed files with 71 additions and 63 deletions
+9 -11
View File
@@ -43,17 +43,16 @@ export default async function serverPostBuildFn(params) {
const mock_req = target_artifact.req_url
? new Request(target_artifact.req_url)
: new Request(controller.page_url);
const page_component = global.IS_SERVER_COMPONENT
? await grabPageComponent({
req: mock_req,
return_server_res_only: true,
is_hydration: true,
})
: {};
// Always re-run server fns so fixed errors clear on the first HMR
const page_component = await grabPageComponent({
req: mock_req,
return_server_res_only: true,
is_hydration: true,
});
if (page_component instanceof Response) {
continue;
}
const { serverRes } = page_component;
const { serverRes } = page_component || {};
const final_artifact = {
..._.omit(controller, ["controller"]),
target_map: target_artifact,
@@ -61,9 +60,8 @@ export default async function serverPostBuildFn(params) {
if (!target_artifact) {
delete final_artifact.target_map;
}
if (serverRes) {
final_artifact.page_props = serverRes;
}
// Always replace so prior error props cannot linger
final_artifact.page_props = serverRes || {};
try {
let final_data = {};
if (global.ROOT_FILE_UPDATED) {