Persist Request accorss hydration refreshes
This commit is contained in:
@@ -6,6 +6,7 @@ type Params = {
|
||||
retry?: boolean;
|
||||
return_server_res_only?: boolean;
|
||||
skip_server_res?: boolean;
|
||||
is_hydration?: boolean;
|
||||
};
|
||||
export default function grabPageComponent(params: Params): Promise<GrabPageComponentRes>;
|
||||
export {};
|
||||
|
||||
+5
-2
@@ -13,7 +13,7 @@ class NotFoundError extends Error {
|
||||
}
|
||||
}
|
||||
export default async function grabPageComponent(params) {
|
||||
const { req, file_path: passed_file_path, debug, return_server_res_only, skip_server_res, } = params;
|
||||
const { req, file_path: passed_file_path, debug, return_server_res_only, skip_server_res, is_hydration, } = params;
|
||||
const url = req?.url ? new URL(req.url) : undefined;
|
||||
const router = global.ROUTER;
|
||||
let routeParams = undefined;
|
||||
@@ -39,13 +39,16 @@ export default async function grabPageComponent(params) {
|
||||
// log.error(errMsg);
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
const bundledMap = global.BUNDLER_CTX_MAP?.[file_path];
|
||||
const bundledMap = global.BUNDLER_CTX_MAP[file_path];
|
||||
if (!bundledMap?.path) {
|
||||
console.log(global.BUNDLER_CTX_MAP);
|
||||
const errMsg = `No Bundled File Path for this request path!`;
|
||||
log.error(errMsg);
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
if (req && !is_hydration) {
|
||||
global.BUNDLER_CTX_MAP[file_path].req = req;
|
||||
}
|
||||
if (debug) {
|
||||
log.info(`bundledMap:`, bundledMap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user