-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(toolbar): fix toolbar rendering - hide empty button groups #972
Conversation
WalkthroughThis update refactors the toolbar content rendering within the ToolbarContent component. The computation of toolbar content is now optimized using a Changes
Sequence Diagram(s)sequenceDiagram
participant TC as ToolbarContent Component
participant UM as useMemo Hook
participant TS as Toolbar Settings
participant RC as Render JSX
TC->>UM: Compute toolbarContent
UM->>TS: Iterate over sections and controls
TS-->>UM: Return processed sections (filtered & mapped)
UM->>TC: Supply computed toolbarContent
TC->>RC: Map toolbarContent for rendering
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Bundle size diff
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/features/toolbar/components/ToolbarContent/ToolbarContent.tsx
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/features/toolbar/components/ToolbarContent/ToolbarContent.tsx
[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (3)
src/features/toolbar/components/ToolbarContent/ToolbarContent.tsx (3)
8-15
: LGTM! Well-structured type definitions.The new
ToolbarControlButton
type and its imports provide clear type safety for the toolbar button structure.
20-32
: LGTM! Effective optimization and empty section filtering.The
useMemo
implementation efficiently:
- Caches the toolbar content computation
- Correctly filters out empty sections
- Maintains type safety with TypeScript
36-63
: LGTM! Clean and efficient rendering logic.The implementation effectively renders only non-empty sections with proper dividers, which aligns with the PR objectives.
🧰 Tools
🪛 Biome (1.9.4)
[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
src/features/toolbar/components/ToolbarContent/ToolbarContent.tsx
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (25.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #972 +/- ##
==========================================
- Coverage 10.02% 10.02% -0.01%
==========================================
Files 669 669
Lines 29459 29467 +8
Branches 1236 1236
==========================================
Hits 2954 2954
- Misses 25975 25983 +8
Partials 530 530
☔ View full report in Codecov by Sentry. |
Bundle ReportChanges will increase total bundle size by 278 bytes (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: konturio/disaster-ninja-fe-esmAssets Changed:
Files in
|
ca32dcd
to
18699d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/features/toolbar/components/ToolbarContent/ToolbarContent.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: test
🔇 Additional comments (2)
src/features/toolbar/components/ToolbarContent/ToolbarContent.tsx (2)
1-15
: LGTM! Well-structured type definitions.The new type definitions and imports enhance type safety and code clarity.
20-32
: LGTM! Efficient implementation of toolbar content processing.The useMemo hook effectively optimizes the computation by caching the toolbar content and filtering out empty sections, which aligns with the PR objective.
https://kontur.fibery.io/Tasks/Task/Hide-button-group-on-Toolbar-if-it's-empty-17352
Summary by CodeRabbit