Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves resilience of Filament dashboard chart widgets by wrapping their data queries/aggregation loops in try/catch blocks so widget rendering won’t hard-fail on query-time exceptions. It also performs small test cleanups to use the global app() helper consistently and removes a redundant assertion from a seeder test.
Changes:
- Added try/catch around chart widget query + bucketing logic in
ConversionChartWidget,RevenueChartWidget, andSubscriptionsChartWidget. - Refactored several feature tests to use
app()instead of$this->appfor container access. - Simplified
DatabaseSeederTestto explicitly perform no assertions while still executing the seeder.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Filament/Widgets/SubscriptionsChartWidget.php |
Wrap subscription aggregation query and bucketing loop with exception handling. |
src/Filament/Widgets/RevenueChartWidget.php |
Wrap revenue aggregation query and bucketing loop with exception handling. |
src/Filament/Widgets/ConversionChartWidget.php |
Wrap conversion aggregation query and bucketing loop with exception handling. |
tests/Feature/WebhookIdempotencyTest.php |
Use app() helper for container binding and service resolution in setup. |
tests/Feature/SubscriptionResumeTest.php |
Use app() helper for container binding in setup. |
tests/Feature/SubscriptionCancelTest.php |
Use app() helper for container binding in setup. |
tests/Feature/CheckoutSessionValidationTest.php |
Use app() helper for container binding in setup. |
tests/Feature/CheckoutControllerTest.php |
Use app() helper for container binding in setup. |
tests/Feature/BillingServiceTest.php |
Use app() helper for container binding and service resolution in setup. |
tests/Feature/DatabaseSeederTest.php |
Remove redundant assertion and mark test as not performing assertions while still seeding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces improved error handling for chart widgets and minor code cleanups in test files. The most significant updates are the addition of try-catch blocks to prevent unhandled exceptions in dashboard widgets, and minor refactoring to use the global
app()helper in tests for consistency.Error handling improvements in chart widgets:
getData()forConversionChartWidget,RevenueChartWidget, andSubscriptionsChartWidget, ensuring that exceptions are caught and reported rather than causing widget failures. [1] [2] [3] [4] [5] [6]Test code refactoring:
app()helper instead of$this->app, improving code consistency in multiple test files. [1] [2] [3] [4] [5] [6]DatabaseSeederTestby removing a redundant assertion and explicitly calling$this->expectNotToPerformAssertions().