@mandujs/core 0.9.20 → 0.9.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/runtime/server.ts +13 -1
package/package.json
CHANGED
package/src/runtime/server.ts
CHANGED
|
@@ -358,7 +358,19 @@ async function handleRequest(req: Request, router: Router): Promise<Response> {
|
|
|
358
358
|
if (loader) {
|
|
359
359
|
try {
|
|
360
360
|
const module = await loader();
|
|
361
|
-
|
|
361
|
+
// module.default가 { component, filling } 객체인 경우 component 추출
|
|
362
|
+
const exported = module.default;
|
|
363
|
+
const component = typeof exported === 'function'
|
|
364
|
+
? exported
|
|
365
|
+
: exported?.component ?? exported;
|
|
366
|
+
registerRouteComponent(route.id, component);
|
|
367
|
+
|
|
368
|
+
// filling이 있으면 loader 실행
|
|
369
|
+
const filling = typeof exported === 'object' ? exported?.filling : null;
|
|
370
|
+
if (filling?.hasLoader?.()) {
|
|
371
|
+
const ctx = new ManduContext(req, params);
|
|
372
|
+
loaderData = await filling.executeLoader(ctx);
|
|
373
|
+
}
|
|
362
374
|
} catch (err) {
|
|
363
375
|
const pageError = createPageLoadErrorResponse(
|
|
364
376
|
route.id,
|