Skip to content

Commit 2d2e5cf

Browse files
authored
fix Hot restart/reload and service extension response deserialization error (#2771)
- Fix deserialization of `HotReloadResponse`, `HotRestartResponse`, and `ServiceExtensionResponse` in the `DevHandler`. Noticed issue in #2765 Fixes #2770
1 parent 27b877c commit 2d2e5cf

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎dwds/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Update `ConnectFailure`, `DebugStateChange`, `DevToolsOpener`, `DevToolsUrl`, `DevToolsRequest`, `DevToolsResponse`, `ExtensionRequest`, `ExtensionResponse`, `ExtensionEvent`, `BatchedEvents` and `DebugInfo` serialization to mimic `built_value`'s list-based format to resolve compatibility issues with the debug extension.
66
- Throw `RPCError` when providing invalid `pause_isolates_on_start` values to the Chrome Proxy Service.
77
- Add and export `BuildRunnerDdcLibraryBundleStrategyProvider`.
8+
- Fix deserialization of `HotReloadResponse`, `HotRestartResponse`, and `ServiceExtensionResponse` in the `DevHandler`.
89

910
## 26.2.5
1011
- Remove `package:built_value` dependency from `ErrorResponse` and `RegisterEvent`; switch to standard Dart JSON serialization.

‎dwds/lib/src/handlers/dev_handler.dart‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,22 @@ class DevHandler {
182182
// Map-based RPC data types:
183183
'ConnectRequest' => ConnectRequest.fromJson(jsonData),
184184
'RunRequest' => RunRequest.fromJson(jsonData),
185-
'HotReloadRequest' => HotReloadRequest.fromJson(jsonData),
186-
'HotRestartRequest' => HotRestartRequest.fromJson(jsonData),
187-
'ServiceExtensionRequest' => ServiceExtensionRequest.fromJson(jsonData),
188-
'BuildResult' => BuildResult.fromJson(jsonData),
185+
'HotReloadResponse' => HotReloadResponse.fromJson(jsonData),
186+
'HotRestartResponse' => HotRestartResponse.fromJson(jsonData),
187+
'ServiceExtensionResponse' => ServiceExtensionResponse.fromJson(
188+
jsonData,
189+
),
189190
'ErrorResponse' => ErrorResponse.fromJson(jsonData),
190191
'DebugEvent' => DebugEvent.fromJson(jsonData),
191192
'BatchedDebugEvents' => BatchedDebugEvents.fromJson(jsonData),
192193
'IsolateStart' => IsolateStart.fromJson(jsonData),
193194
'IsolateExit' => IsolateExit.fromJson(jsonData),
194195
'RegisterEvent' => RegisterEvent.fromJson(jsonData),
195-
_ => null,
196+
197+
_ => throw FormatException('Unrecognized event type: $typeName'),
196198
};
197199
}
198-
return null;
200+
throw FormatException('Unrecognized event type: $decoded');
199201
}
200202

201203
/// Sends the provided [request] to all connected injected clients.

0 commit comments

Comments
 (0)