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 b16fd3f commit 67d0701Copy full SHA for 67d0701
examples/app-pages-router/middleware.ts
@@ -2,11 +2,13 @@ import type { NextRequest } from "next/server";
2
import { NextResponse } from "next/server";
3
4
// Needed to test top-level await
5
+// We are using `setTimeout` to simulate a "long" running operation
6
+// we could have used `Promise.resolve` instead, but it would be running in a different way in the event loop
7
// @ts-expect-error - It will cause a warning at build time, but it should just work
8
const topLevelAwait = await new Promise<string>((resolve) => {
9
setTimeout(() => {
10
resolve("top-level-await");
- }, 150);
11
+ }, 10);
12
});
13
14
export function middleware(request: NextRequest) {
0 commit comments