-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass hot reload/hot restart callbacks and reload sources path to StrategyProviders instead #2584
Comments
Actually, the vm service has a hook to invoke a service extension (specifically |
dart-lang#2584 This can and should be done in Flutter tools.
- Updates restart/reload code to accept a resetCompiler boolean to disambiguate between whether this is a full restart and whether to reset the resident compiler. - Adds code to call reloadSources in DWDS and handle the response (including any errors). - Adds code to invoke reassemble. - Adds code to emit a script that DWDS can later consume that contains the changed sources and their associated libraries. This is used to hot reload. The bootstrapper puts this in the global window. DWDS should be updated to accept it in the provider itself. See dart-lang/webdev#2584. - Adds code to parse module metadata from the frontend server. This is identical to the implementation in DWDS % addressing type-related lints. - Adds tests that run the existing hot reload tests but with web. Some modifications are mode, including waiting for Flutter runs to finish executing, and skipping a test that's not possible on the web.
dart-lang/webdev#2516 - Updates restart/reload code to accept a resetCompiler boolean to disambiguate between whether this is a full restart and whether to reset the resident compiler. - Adds code to call reloadSources in DWDS and handle the response (including any errors). - Adds code to invoke reassemble. - Adds code to emit a script that DWDS can later consume that contains the changed sources and their associated libraries. This is used to hot reload. The bootstrapper puts this in the global window. DWDS should be updated to accept it in the provider itself. See dart-lang/webdev#2584. - Adds code to parse module metadata from the frontend server. This is identical to the implementation in DWDS % addressing type-related lints. - Adds tests that run the existing hot reload tests but with web. Some modifications are mode, including waiting for Flutter runs to finish executing, and skipping a test that's not possible on the web. Needs DWDS 24.3.4 to be published first and used before we can land. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing.
A consideration on moving Since |
…ovider and publish DWDS 24.3.6 dart-lang#2584 During hot reload, a JSON file that contains the sources and libraries that need to be loaded and reloaded is expected. Before, Flutter tools was adding this script to the global window. It should instead be directly passed to the provider to be used later.
…ovider and publish DWDS 24.3.6 (#2594) #2584 During hot reload, a JSON file that contains the sources and libraries that need to be loaded and reloaded is expected. Before, Flutter tools was adding this script to the global window. It should instead be directly passed to the provider to be used later.
…erverDdcLibraryBundleProvider (#164582) The path to reload scripts JSON was being added to the global window before. It should instead be passed to the provider on setup. In order to do this, the baseUri calculation is moved into the WebAssetServer. This is safe because Flutter tools was calculating it immediately after creating the server anyways. dart-lang/webdev#2584 Existing hot reload tests should test this behavior. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing.
…ethodNotFound when extension not found and remove reassemble from reload dart-lang#2584 Currently, callServiceExtension checks the extensionRpcs field in the VM service. This list is populated when DWDS starts and checks the extensions currently registered in the runtime. This list is prone to becoming stale, however, as services may be registered or removed through the runtime (via dart:developer) later. This is true for ext.flutter.reassemble, where DWDS can not find the service because we computed the list too early. Instead, we should seek to always check the runtime for the current registered extensions and then update this list whenever we do. It’s still prone to becoming stale, but it is less stale. Ideally, we would override extensionRpcs and fetch the current registered extensions, but that isn’t possible since it requires awaiting a future. We also can’t ignore this field altogether because it looks like clients, like Dart DevTools, uses this field. callServiceExtension should also return kMethodNotFound instead of its current JS evaluation error when an extension is not present. Lastly, the reassemble call is removed from reload as it can now be safely called in Flutter tools instead.
dart-lang#2584 This can and should be done in Flutter tools.
Currently, with hot restart, we call a developer extension method to disassemble the Flutter engine after we've successfully hot restarted the application. This allows the Flutter engine to restart state.
As we add hot reload, we're doing something similar: reassembling the Flutter engine so that it renders a new frame after a hot reload.
Similarly, we assume there exists a path in the global window that the injected client can request to find the paths that have changed for a hot reload.
This would also help analytics determine the cost of reload vs reassemble.
These are all implicit assumptions that are tied to Flutter tools. We should avoid this and instead have the providers take several options:
reassemble
.The text was updated successfully, but these errors were encountered: