Skip to content

Use baseUri of WebAssetServer for reload_scripts.json #169267

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

Merged
merged 3 commits into from
May 23, 2025

Conversation

dumazy
Copy link
Contributor

@dumazy dumazy commented May 22, 2025

This allows embedded Flutter Web apps, hosted on a different URL than the host app, to hot reload the correct files.

This fixes issues mentioned in:

It specifically allows you to use hot reload when debugging an embedded Flutter Web app, running in the spawned Chrome browser via the -d chrome flag, as mentioned in dart-lang/sdk#60776 (comment)

Result

This would result in the following reload_scripts.json for an embedded Flutter web app, running on localhost:8081:

[{
    "src": "http://localhost:8081/packages/web_hot_reload/main.dart.lib.js",
    "libraries": ["package:web_hot_reload/main.dart"]
}]

Normal Flutter Web apps

This also adds the baseUri to the maps for normal Flutter Web apps, for example:

[{
    "src": "http://localhost:54609/packages/web_hot_reload/main.dart.lib.js",
    "libraries": ["package:web_hot_reload/main.dart"]
}]

instead of the previous:

[{
    "src": "packages/web_hot_reload/main.dart.lib.js",
    "libraries": ["package:web_hot_reload/main.dart"]
}]

While both actually work, I'm not sure if there might be cases in which this would have another side effect.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

This allows embedded Flutter Web apps, hosted on a different URL than the host app, to reload the correct files
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 22, 2025
@biggs0125 biggs0125 requested a review from srujzs May 22, 2025 22:02
@biggs0125
Copy link
Contributor

Thanks for digging into this! Seems like a reasonable change to me but hopefully some folks who have worked in these file serving libraries a bit more can verify.

Copy link
Contributor

@srujzs srujzs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this!

This should be fine in the non-embedded case. This only ever gets use in the module loader when we load script elements.

@srujzs
Copy link
Contributor

srujzs commented May 23, 2025

@dumazy I'm guessing you don't have write access, so I'll apply the autosubmit label so that it merges when the tree's green. Thanks again!

@srujzs srujzs added the autosubmit Merge PR when tree becomes green via auto submit App label May 23, 2025
Copy link
Contributor

auto-submit bot commented May 23, 2025

autosubmit label was removed for flutter/flutter/169267, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 23, 2025
@srujzs
Copy link
Contributor

srujzs commented May 23, 2025

@natebiggs Looks like we need one more approval, mind approving?

@srujzs srujzs added the autosubmit Merge PR when tree becomes green via auto submit App label May 23, 2025
@auto-submit auto-submit bot added this pull request to the merge queue May 23, 2025
Merged via the queue into flutter:master with commit 171e272 May 23, 2025
143 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 23, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 24, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request May 24, 2025
flutter/flutter@85564cb...60050a0

2025-05-24 [email protected] Roll Skia from 0834eea9de33 to 91dc88dc70e5 (1 revision) (flutter/flutter#169414)
2025-05-24 [email protected] Roll Dart SDK from 0a6b16a55b9e to 7dab9bffe1f7 (1 revision) (flutter/flutter#169406)
2025-05-24 [email protected] Correct calculation for CupertinoTextSelectionToolbar vertical position (flutter/flutter#169308)
2025-05-24 [email protected] Baseline-align CupertinoTextField placeholder (flutter/flutter#166952)
2025-05-24 [email protected] Roll Dart SDK from 8354914ef97b to 0a6b16a55b9e (3 revisions) (flutter/flutter#169403)
2025-05-24 [email protected] Start removing Observatory support and references (flutter/flutter#169216)
2025-05-23 [email protected] Roll Skia from f42bb59753fe to 0834eea9de33 (3 revisions) (flutter/flutter#169393)
2025-05-23 [email protected] Roll Skia from 956fd8b14e22 to f42bb59753fe (2 revisions) (flutter/flutter#169379)
2025-05-23 [email protected] [Engine] Fast blurring algorithm for RSuperellipse (flutter/flutter#169187)
2025-05-23 [email protected] Add a page describing best CI practices for `flutter`-org repos (flutter/flutter#169364)
2025-05-23 [email protected] Revert "Mark web_tool_tests_1_2 as bringup." (flutter/flutter#169361)
2025-05-23 [email protected] Add changelog section for 3.32.0 and 3.32.1, and add note for ndk checking cherry pick (flutter/flutter#169369)
2025-05-23 [email protected] Roll Dart SDK from 085f110ecf33 to 8354914ef97b (1 revision) (flutter/flutter#169349)
2025-05-23 [email protected] Remove handling of the legacy `.flutter-plugins` file in `PluginHandler.kt`. (flutter/flutter#169317)
2025-05-23 [email protected] Use baseUri of WebAssetServer for reload_scripts.json (flutter/flutter#169267)
2025-05-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Use pub workspace (#168662)" (flutter/flutter#169357)
2025-05-23 [email protected] Use pub workspace (flutter/flutter#168662)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
zeqinjie pushed a commit to zeqinjie/flutter that referenced this pull request Jun 5, 2025
* master: (125 commits)
  Roll Fuchsia Linux SDK from XtPp9bBW49iDJ0wbA... to -eo2JqnJBauuGSzoW... (flutter#169424)
  Roll Skia from 91dc88dc70e5 to 443f5257f382 (1 revision) (flutter#169422)
  Roll Skia from 0834eea9de33 to 91dc88dc70e5 (1 revision) (flutter#169414)
  Roll Dart SDK from 0a6b16a55b9e to 7dab9bffe1f7 (1 revision) (flutter#169406)
  Correct calculation for CupertinoTextSelectionToolbar vertical position (flutter#169308)
  Baseline-align CupertinoTextField placeholder (flutter#166952)
  Roll Dart SDK from 8354914ef97b to 0a6b16a55b9e (3 revisions) (flutter#169403)
  Start removing Observatory support and references (flutter#169216)
  Roll Skia from f42bb59753fe to 0834eea9de33 (3 revisions) (flutter#169393)
  Roll Skia from 956fd8b14e22 to f42bb59753fe (2 revisions) (flutter#169379)
  [Engine] Fast blurring algorithm for RSuperellipse (flutter#169187)
  Add a page describing best CI practices for `flutter`-org repos (flutter#169364)
  Revert "Mark web_tool_tests_1_2 as bringup." (flutter#169361)
  Add changelog section for 3.32.0 and 3.32.1, and add note for ndk checking cherry pick (flutter#169369)
  Roll Dart SDK from 085f110ecf33 to 8354914ef97b (1 revision) (flutter#169349)
  Remove handling of the legacy `.flutter-plugins` file in `PluginHandler.kt`. (flutter#169317)
  Use baseUri of WebAssetServer for reload_scripts.json (flutter#169267)
  Reverts "Use pub workspace (flutter#168662)" (flutter#169357)
  Use pub workspace (flutter#168662)
  Reverts "[Reland2] Implements UISceneDelegate dynamically w/ FlutterLaunchEngine (flutter#169276)" (flutter#169347)
  ...
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
…r#9318)

flutter/flutter@85564cb...60050a0

2025-05-24 [email protected] Roll Skia from 0834eea9de33 to 91dc88dc70e5 (1 revision) (flutter/flutter#169414)
2025-05-24 [email protected] Roll Dart SDK from 0a6b16a55b9e to 7dab9bffe1f7 (1 revision) (flutter/flutter#169406)
2025-05-24 [email protected] Correct calculation for CupertinoTextSelectionToolbar vertical position (flutter/flutter#169308)
2025-05-24 [email protected] Baseline-align CupertinoTextField placeholder (flutter/flutter#166952)
2025-05-24 [email protected] Roll Dart SDK from 8354914ef97b to 0a6b16a55b9e (3 revisions) (flutter/flutter#169403)
2025-05-24 [email protected] Start removing Observatory support and references (flutter/flutter#169216)
2025-05-23 [email protected] Roll Skia from f42bb59753fe to 0834eea9de33 (3 revisions) (flutter/flutter#169393)
2025-05-23 [email protected] Roll Skia from 956fd8b14e22 to f42bb59753fe (2 revisions) (flutter/flutter#169379)
2025-05-23 [email protected] [Engine] Fast blurring algorithm for RSuperellipse (flutter/flutter#169187)
2025-05-23 [email protected] Add a page describing best CI practices for `flutter`-org repos (flutter/flutter#169364)
2025-05-23 [email protected] Revert "Mark web_tool_tests_1_2 as bringup." (flutter/flutter#169361)
2025-05-23 [email protected] Add changelog section for 3.32.0 and 3.32.1, and add note for ndk checking cherry pick (flutter/flutter#169369)
2025-05-23 [email protected] Roll Dart SDK from 085f110ecf33 to 8354914ef97b (1 revision) (flutter/flutter#169349)
2025-05-23 [email protected] Remove handling of the legacy `.flutter-plugins` file in `PluginHandler.kt`. (flutter/flutter#169317)
2025-05-23 [email protected] Use baseUri of WebAssetServer for reload_scripts.json (flutter/flutter#169267)
2025-05-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Use pub workspace (#168662)" (flutter/flutter#169357)
2025-05-23 [email protected] Use pub workspace (flutter/flutter#168662)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants