Skip to content

[CP-beta]Use relative path for reloadedSourcesUri and reloaded modules#185540

Merged
auto-submit[bot] merged 1 commit into
flutter:flutter-3.44-candidate.0from
flutteractionsbot:cp-beta-3a983a2d0d41483bd261ee1b429baf310ff827fc
Apr 24, 2026
Merged

[CP-beta]Use relative path for reloadedSourcesUri and reloaded modules#185540
auto-submit[bot] merged 1 commit into
flutter:flutter-3.44-candidate.0from
flutteractionsbot:cp-beta-3a983a2d0d41483bd261ee1b429baf310ff827fc

Conversation

@flutteractionsbot

@flutteractionsbot flutteractionsbot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.

Issue Link:

#184060

Impact Description:

Hot reload on web fails when opening the app in another domain than the server. This impacts web development.

Changelog Description:

[flutter/184060] When users open an app in a different domain, hot reload will fail to succeed on Web.

Workaround:

None. Users cannot control the format of the sources sent to DWDS.

Risk:

  • Low
  • Medium
  • High

Test Coverage:

  • Yes
  • No

Validation Steps:

Beyond the added test, you can manually test by running flutter run -d web-server --web-hostname=0.0.0.0 --web-port=8080, opening <ip_address>:8080 on another computer on the same network, and checking that hot reload changes are visible on the other computer.

…r#184598)

Fixes flutter#184060

The app may be opened in a separate domain than the server. Therefore,
we need to provide relative paths/URIs to the root instead of including
the server URI.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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.
- [x] All existing and new tests are passing.
@flutteractionsbot flutteractionsbot added the cp: review Cherry-picks in the review queue label Apr 24, 2026
@flutteractionsbot

Copy link
Copy Markdown
Contributor Author

@srujzs please fill out the PR description above, afterwards the release team will review this request.

@flutter-dashboard

Copy link
Copy Markdown

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 24, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the WebAssetServer to use relative paths for reloaded sources in the DDC library bundle, ensuring the application can locate them even when served from different domains. The changes replace the static filename with a reloadedSourcesUri and update the JSON output to include a leading slash for module paths. A new test case has been added to verify these relative paths. Feedback includes a suggestion to mark the new static Uri as final and a correction for Dart formatting in a json.decode call.

// Use relative path for the URI so the app can still find it even if it's in
// a different domain than the server.
@visibleForTesting
static Uri reloadedSourcesUri = Uri.parse('reloaded_sources.json');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The reloadedSourcesUri field is a static mutable variable. Since it represents a constant relative path used across the server, it should be marked as final to prevent accidental reassignment and ensure consistency.

Suggested change
static Uri reloadedSourcesUri = Uri.parse('reloaded_sources.json');
static final Uri reloadedSourcesUri = Uri.parse('reloaded_sources.json');

Comment on lines +151 to 154
json.decode(
utf8.decode(_webMemoryFS.metadataFiles['$relativeModulePath.metadata']!.toList()),
)
as Map<String, dynamic>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The indentation and formatting of the json.decode call do not appear to follow standard Dart style (as enforced by dart format). The nested utf8.decode call has excessive indentation.

Suggested change
json.decode(
utf8.decode(_webMemoryFS.metadataFiles['$relativeModulePath.metadata']!.toList()),
)
as Map<String, dynamic>,
json.decode(
utf8.decode(_webMemoryFS.metadataFiles['$relativeModulePath.metadata']!.toList()),
) as Map<String, dynamic>,
References
  1. All Dart code is formatted using dart format. (link)

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CPLGTM 👍 . Apologies that I missed this PR earlier in the week, it will likely not be released until next week.

@justinmc justinmc added the CICD Run CI/CD label Apr 24, 2026
@justinmc

Copy link
Copy Markdown
Contributor

One weird test failure, possibly an infra issue. I've rerun it.

  Exception: Received app.stop event while waiting for app.started event
  
  _createDevFS: (1001) File system already exists
  _createDevFS: file system 'flutter_attach_test.ZVQRIC' already exists

@srujzs

srujzs commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

CPLGTM 👍 . Apologies that I missed this PR earlier in the week, it will likely not be released until next week.

No worries, we didn't realize we wanted to cherry-pick this until very recently anyways. :)

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 24, 2026
@auto-submit auto-submit Bot merged commit e46d7dd into flutter:flutter-3.44-candidate.0 Apr 24, 2026
154 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD cp: review Cherry-picks in the review queue 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