Skip to content

Commit d70ae46

Browse files
committed
handle async server references in turbopack
1 parent 6eda534 commit d70ae46

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopack.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,19 @@ export function resolveServerReference<T>(
132132
);
133133
}
134134
}
135-
// TODO: This needs to return async: true if it's an async module.
135+
if (resolvedModuleData.async) {
136+
// If the module is marked as async in a Client Reference, we don't actually care.
137+
// What matters is whether the consumer wants to unwrap it or not.
138+
// For Server References, it is different because the consumer is completely internal
139+
// to the bundler. So instead of passing it to each reference we can mark it in the
140+
// manifest.
141+
return [
142+
resolvedModuleData.id,
143+
resolvedModuleData.chunks,
144+
name,
145+
1 /* async */,
146+
];
147+
}
136148
return [resolvedModuleData.id, resolvedModuleData.chunks, name];
137149
}
138150

0 commit comments

Comments
 (0)