refactor(ui): rename StreamContextMenuItem to StreamContextMenuAction#56
refactor(ui): rename StreamContextMenuItem to StreamContextMenuAction#56xsahil03x merged 2 commits intomain-design-systemfrom
Conversation
… update related components
📝 WalkthroughWalkthroughThis PR refactors the context menu system from a Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart (1)
255-266: Consider constrainingTtoObjectinstead ofObject?.
StreamContextMenuActionProps<T extends Object?>allowsTitself to be a nullable type (e.g.,StreamContextMenuAction<String?>). Combined withfinal T? value, thevaluefield then has typeString??which Dart flattens toString?, making it impossible to distinguish "no value provided" from "value is explicitly null." IfT extends Object, the nullability ofvalueremains meaningful. This is the same patternPopupMenuEntry<T>uses in Flutter.Proposed change
-class StreamContextMenuActionProps<T extends Object?> { +class StreamContextMenuActionProps<T extends Object> {And correspondingly on the widget class:
-class StreamContextMenuAction<T> extends StatelessWidget { +class StreamContextMenuAction<T extends Object> extends StatelessWidget {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart` around lines 255 - 266, Change the generic bound from T extends Object? to T extends Object for StreamContextMenuActionProps and the corresponding widget class (e.g., StreamContextMenuAction) so that the value field (final T? value) can represent “no value provided” vs “explicit null” correctly; update any related declarations and constructors that declare StreamContextMenuActionProps<T extends Object?> and StreamContextMenuAction<T extends Object?> to use T extends Object instead, keeping the rest of the API (value as T?) unchanged.apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart (1)
1006-1026: Hardcoded border radius in_ResultChip.Line 1013 uses
BorderRadius.circular(6)while the rest of the gallery consistently usesStreamRadiustokens (e.g.,radius.xs,radius.lg). Consider using a stream radius token for consistency.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart` around lines 1006 - 1026, The _ResultChip widget currently uses a hardcoded BorderRadius.circular(6); replace that with the design token (e.g., radius.xs) so the gallery uses StreamRadius tokens consistently—locate BorderRadius.circular(6) in _ResultChip and change it to use BorderRadius.circular(radius.xs) (or the appropriate radius token like radius.lg per visual spec).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart`:
- Around line 556-613: The onTap handler in _TypedValueReturnCardState awaits
showDialog and then calls setState without checking mounted; update the handler
in the StreamButton onTap (the async closure inside _TypedValueReturnCardState)
to guard the post-await setState with a mounted check (e.g., if (!mounted)
return; or if (mounted) setState(...)) so you only update _result when the State
is still active; apply the same mounted-guard fix to the analogous async onTap
in _EnumValueReturnCardState that sets state after awaiting showDialog.
---
Nitpick comments:
In
`@apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart`:
- Around line 1006-1026: The _ResultChip widget currently uses a hardcoded
BorderRadius.circular(6); replace that with the design token (e.g., radius.xs)
so the gallery uses StreamRadius tokens consistently—locate
BorderRadius.circular(6) in _ResultChip and change it to use
BorderRadius.circular(radius.xs) (or the appropriate radius token like radius.lg
per visual spec).
In
`@packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart`:
- Around line 255-266: Change the generic bound from T extends Object? to T
extends Object for StreamContextMenuActionProps and the corresponding widget
class (e.g., StreamContextMenuAction) so that the value field (final T? value)
can represent “no value provided” vs “explicit null” correctly; update any
related declarations and constructors that declare
StreamContextMenuActionProps<T extends Object?> and StreamContextMenuAction<T
extends Object?> to use T extends Object instead, keeping the rest of the API
(value as T?) unchanged.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (16)
apps/design_system_gallery/lib/app/gallery_app.directories.g.dartapps/design_system_gallery/lib/components/context_menu/stream_context_menu.dartpackages/stream_core_flutter/lib/src/components.dartpackages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu.dartpackages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dartpackages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_item.dartpackages/stream_core_flutter/lib/src/factory/stream_component_factory.dartpackages/stream_core_flutter/lib/src/factory/stream_component_factory.g.theme.dartpackages/stream_core_flutter/lib/src/theme.dartpackages/stream_core_flutter/lib/src/theme/components/stream_context_menu_action_theme.dartpackages/stream_core_flutter/lib/src/theme/components/stream_context_menu_action_theme.g.theme.dartpackages/stream_core_flutter/lib/src/theme/components/stream_context_menu_item_theme.dartpackages/stream_core_flutter/lib/src/theme/components/stream_context_menu_theme.dartpackages/stream_core_flutter/lib/src/theme/stream_theme.dartpackages/stream_core_flutter/lib/src/theme/stream_theme.g.theme.dartpackages/stream_core_flutter/lib/src/theme/stream_theme_extensions.dart
💤 Files with no reviewable changes (2)
- packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_item.dart
- packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_item_theme.dart
apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (1.05%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main-design-system #56 +/- ##
=====================================================
Coverage ? 32.99%
=====================================================
Files ? 101
Lines ? 3043
Branches ? 0
=====================================================
Hits ? 1004
Misses ? 2039
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
New Features
Refactor