Skip to content

Commit 51e8a74

Browse files
ellietteCommit Queue
authored and
Commit Queue
committed
[DDC] During hot-restart, wait to run main if the promise readyToRunMain is provided
Bug: flutter/devtools#7231 Change-Id: Iebd1caa62cff4f41a226d7214c7a8ae330ed02c4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355880 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
1 parent 215323a commit 51e8a74

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/dev_compiler/lib/js/ddc/ddc_module_loader.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,12 @@ if (!self.dart_library) {
537537
// Starts the subapps in their starting order.
538538
for (const subapp of dirtySubapps) {
539539
// Call the module loader to reload the necessary modules.
540-
self.$dartReloadModifiedModules(subapp.appName, function () {
540+
self.$dartReloadModifiedModules(subapp.appName, async function () {
541+
// If the promise `readyToRunMain` is provided, then wait for
542+
// it. This gives the debugging clients time to set any breakpoints.
543+
if (!!(config && config.readyToRunMain)) {
544+
await config.readyToRunMain;
545+
}
541546
// Once the modules are loaded, rerun `main()`.
542547
start(
543548
subapp.appName, subapp.uuid, subapp.moduleName,

0 commit comments

Comments
 (0)