Repository navigation
Commit 2c72122
authored
[stable] [tool] Fix Windows hot reload mtime truncation issue (#191599)
### Issue Link:
#191198
### Impact Description:
On Windows, file modification timestamps (mtime) reported by `dart:io` are truncated to whole-second precision. When files are edited rapidly (e.g. IDE format/save on change or quick successive edits within the same wall-clock second as the previous compilation), `ProjectFileInvalidator.findInvalidated` compares milliseconds against truncated seconds and falsely concludes that zero files have changed. Hot reload/restart silently skips compiling the changes, leaving running apps on stale code.
### Changelog Description:
[flutter/191198] On Windows, truncate `lastCompiled` timestamp to whole seconds in `ProjectFileInvalidator` so rapid consecutive file modifications within the same second are not silently ignored by hot reload.
### Workaround:
Wait at least 1-2 seconds after saving before triggering hot reload or hot restart.
### Risk:
### Test Coverage:
### Validation Steps:
1. On Windows, run a Flutter app with `flutter run`.
2. Save a change to `lib/main.dart` and trigger hot reload.
3. Immediately edit `lib/main.dart` again within < 1 second and trigger hot reload.
4. Verify that Flutter recompiles and applies the second change rather than reporting `Compiling dart to kernel with 0 updated files`.1 parent aff2b56 commit 2c72122
2 files changed
Lines changed: 97 additions & 3 deletions
File tree
- packages/flutter_tools
- lib/src
- test/general.shard
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1486 | 1486 | | |
1487 | 1487 | | |
1488 | 1488 | | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
1489 | 1503 | | |
1490 | 1504 | | |
1491 | 1505 | | |
| |||
1502 | 1516 | | |
1503 | 1517 | | |
1504 | 1518 | | |
1505 | | - | |
| 1519 | + | |
1506 | 1520 | | |
1507 | 1521 | | |
1508 | 1522 | | |
| |||
1517 | 1531 | | |
1518 | 1532 | | |
1519 | 1533 | | |
1520 | | - | |
| 1534 | + | |
1521 | 1535 | | |
1522 | 1536 | | |
1523 | 1537 | | |
| |||
1527 | 1541 | | |
1528 | 1542 | | |
1529 | 1543 | | |
1530 | | - | |
| 1544 | + | |
1531 | 1545 | | |
1532 | 1546 | | |
1533 | 1547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
135 | 215 | | |
136 | 216 | | |
0 commit comments