Skip to content

Commit 92a5336

Browse files
committed
Fix awaiting for future
In #2491, the reloader was changed to pass two arguments instead of an object with two fields into dartLibrary.reload. As a result, the javascript side couldn't find the promise in a field of the first argument and ignored the second argument. Usually it is fine, but this broke postponing main launch until the attached debugger can configure breakpoints. Again, this is not a big deal for interactive long-running apps, but if the main is fast and short (e.g. tests), this effectively prevents interactive debugging from an IDE.
1 parent a407cc1 commit 92a5336

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

dwds/web/reloader/ddc_restarter.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@ import 'restarter.dart';
1313
external DartLibrary dartLibrary;
1414

1515
extension type DartLibrary._(JSObject _) implements JSObject {
16-
external void reload(String? runId, JSPromise? readyToRunMain);
16+
external void reload(ReloadConfiguration configuration);
17+
}
18+
19+
@anonymous
20+
@JS()
21+
@staticInterop
22+
class ReloadConfiguration {
23+
external factory ReloadConfiguration({
24+
String? runId,
25+
JSPromise? readyToRunMain,
26+
});
1727
}
1828

1929
class DdcRestarter implements Restarter {
@@ -27,7 +37,9 @@ class DdcRestarter implements Restarter {
2737
reloadedSourcesPath == null,
2838
"'reloadedSourcesPath' should not be used for the DDC module format.",
2939
);
30-
dartLibrary.reload(runId, readyToRunMain?.toJS);
40+
dartLibrary.reload(
41+
ReloadConfiguration(runId: runId, readyToRunMain: readyToRunMain?.toJS),
42+
);
3143
final reloadCompleter = Completer<bool>();
3244
final sub = window.onMessage.listen((event) {
3345
final message = event.data?.dartify();

0 commit comments

Comments
 (0)