We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 681646f commit 9703acaCopy full SHA for 9703aca
src/inertia-helpers/index.ts
@@ -1,8 +1,9 @@
1
-export async function resolvePageComponent<T>(path: string, pages: Record<string, T | (() => Promise<T>)>) {
+export async function resolvePageComponent<T>(path: string, pages: Record<string, Promise<T> | (() => Promise<T>)>): Promise<T> {
2
const page = pages[path]
3
+
4
if (typeof page === 'undefined') {
5
throw new Error(`Page not found: ${path}`)
6
}
7
- return typeof page === 'function' ? await (page as () => Promise<T>)() : page
8
+ return typeof page === 'function' ? page() : page
9
0 commit comments