Add signal r#66
Conversation
…l, men i teorien burde det virke som intended
…owdedRegionDetection into AddSignalR And resolved merge conflict with anders?
There was a problem hiding this comment.
Pull Request Overview
This PR introduces SignalR support for real‐time updates and updates several widget tests related to the canteen views.
- Adjusts test implementations for navigation and rendering.
- Updates the canteen page to improve heatmap refresh logic and error handling.
- Modifies backend configuration by adding SignalR services and hub mappings (with duplicate registrations).
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crowdedapp/test/navigation_test.dart | Replaces pumpAndSettle with a fixed pump duration in a test scenario. |
| crowdedapp/test/canteen_page_render_test.dart | Adds test coverage for rendering the CanteenPage. |
| crowdedapp/test/canteen_loading_test.dart | Removes the canteen loading test from the suite. |
| crowdedapp/lib/canteen_pages.dart | Updates heatmap refresh logic including error handling and UI state management. |
| CrowdedBackend/CrowdedBackend/Program.cs | Adds SignalR service registration and hub mapping, but introduces duplicate registrations. |
| await tester.pumpAndSettle(); | ||
| // Tap the Canteen tab | ||
| await tester.tap(find.byIcon(Icons.restaurant)); | ||
| await tester.pump(const Duration(seconds: 1)); // Use a fixed pump duration instead of pumpAndSettle |
There was a problem hiding this comment.
Using a fixed pump duration might lead to flaky tests if UI animations or state transitions take longer than expected. Consider using pumpAndSettle or a more dynamic wait mechanism to ensure reliable test behavior.
| await tester.pump(const Duration(seconds: 1)); // Use a fixed pump duration instead of pumpAndSettle | |
| await tester.pumpAndSettle(); // Dynamically wait for all animations and transitions to complete |
| print('Received NewDevicesDetected: $arguments'); | ||
| _hubConnection?.on('NewDevicesDetected', (arguments) async { | ||
| print('SignalR: NewDevicesDetected event received!'); | ||
| print('Jeg bliver ikke mounted'); |
There was a problem hiding this comment.
[nitpick] Debug print statements such as this should be removed or replaced with proper logging before merging to production to reduce noise.
| print('Jeg bliver ikke mounted'); | |
| log('SignalR: Component not mounted during NewDevicesDetected event.', name: 'CanteenPage'); |
|
|
||
| builder.Services.AddSignalR(); | ||
|
|
||
| var app = builder.Build(); | ||
|
|
||
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | ||
|
|
||
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | ||
|
|
There was a problem hiding this comment.
Duplicate registration of SignalR services detected. Ensure that SignalR is only added once to avoid potential conflicts or unexpected behavior.
| builder.Services.AddSignalR(); | |
| var app = builder.Build(); | |
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | |
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | |
| var app = builder.Build(); | |
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); |
|
|
||
| builder.Services.AddSignalR(); | ||
|
|
||
| var app = builder.Build(); | ||
|
|
||
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | ||
|
|
||
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | ||
|
|
There was a problem hiding this comment.
Duplicate hub mapping for '/hubs/detecteddevices' found. Remove the redundant mapping to prevent routing conflicts.
| builder.Services.AddSignalR(); | |
| var app = builder.Build(); | |
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | |
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); | |
| var app = builder.Build(); | |
| app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices"); |
Flere lækkerier til develop :)