Skip to content

Add signal r#66

Merged
davidfraenkel merged 17 commits into
developfrom
AddSignalR
May 9, 2025
Merged

Add signal r#66
davidfraenkel merged 17 commits into
developfrom
AddSignalR

Conversation

@Frederik-Lauridsen

Copy link
Copy Markdown
Contributor

Flere lækkerier til develop :)

@Frederik-Lauridsen Frederik-Lauridsen requested a review from Copilot May 9, 2025 09:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copilot AI May 9, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
print('Received NewDevicesDetected: $arguments');
_hubConnection?.on('NewDevicesDetected', (arguments) async {
print('SignalR: NewDevicesDetected event received!');
print('Jeg bliver ikke mounted');

Copilot AI May 9, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Debug print statements such as this should be removed or replaced with proper logging before merging to production to reduce noise.

Suggested change
print('Jeg bliver ikke mounted');
log('SignalR: Component not mounted during NewDevicesDetected event.', name: 'CanteenPage');

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +49

builder.Services.AddSignalR();

var app = builder.Build();

app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices");

app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices");

Copilot AI May 9, 2025

Copy link

Choose a reason for hiding this comment

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

Duplicate registration of SignalR services detected. Ensure that SignalR is only added once to avoid potential conflicts or unexpected behavior.

Suggested change
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");

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +49

builder.Services.AddSignalR();

var app = builder.Build();

app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices");

app.MapHub<DetectedDeviceHub>("/hubs/detecteddevices");

Copilot AI May 9, 2025

Copy link

Choose a reason for hiding this comment

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

Duplicate hub mapping for '/hubs/detecteddevices' found. Remove the redundant mapping to prevent routing conflicts.

Suggested change
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");

Copilot uses AI. Check for mistakes.
@davidfraenkel davidfraenkel merged commit ef2e449 into develop May 9, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants