-
-
Notifications
You must be signed in to change notification settings - Fork 808
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
Fixed LeftDrawerOrg Visibility #3239
Fixed LeftDrawerOrg Visibility #3239
Conversation
WalkthroughThe pull request modifies the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🧰 Additional context used📓 Learnings (1)src/components/LeftDrawerOrg/LeftDrawerOrg.spec.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (4)
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
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
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: 0
🧹 Nitpick comments (2)
src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (2)
77-82
: LGTM! Consider adding a comment to explain the initialization logic.The useEffect hook correctly initializes the drawer's visibility state. To improve maintainability, consider adding a comment explaining why null is treated as false.
useEffect(() => { + // Initialize drawer visibility to visible (false) when not explicitly set (null) if (hideDrawer === null) { setHideDrawer(false); } }, []);
Line range hint
16-21
: Consider improving the hideDrawer prop type.The current type allows
null
which is only used for initialization. Consider using a default value instead:export interface InterfaceLeftDrawerProps { orgId: string; targets: TargetsType[]; - hideDrawer: boolean | null; + hideDrawer?: boolean; setHideDrawer: React.Dispatch<React.SetStateAction<boolean | null>>; }Then provide a default prop:
const leftDrawerOrg = ({ targets, orgId, hideDrawer = false, setHideDrawer, }: InterfaceLeftDrawerProps): JSX.Element => {This would eliminate the need for null checking and make the component's API more intuitive.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/LeftDrawerOrg/LeftDrawerOrg.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test Application
- GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (1)
src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (1)
77-82
: Verify the fix resolves the visibility issue.The implementation effectively fixes the drawer visibility by:
- Initializing hideDrawer to false when null
- Maintaining existing visibility control when explicitly set
- Using proper React patterns for state initialization
The fix aligns with the PR objective to address the visibility bug (#3237).
Also applies to: 16-21
✅ Verification successful
✓ The initialization pattern is consistent with codebase practices
The implementation in LeftDrawerOrg follows an established pattern across the codebase where drawer components initialize
hideDrawer
fromnull
tofalse
. This is consistent with:
- Similar initialization in LeftDrawer component
- Existing test coverage for null state handling
- Usage patterns in parent components
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify no other components rely on null state rg -l "hideDrawer.*null" src/Length of output: 775
Script:
#!/bin/bash # Check the context of hideDrawer null usage rg "hideDrawer.*null" src/ -B 2 -A 2Length of output: 16145
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.
- What test can be done for this and the other left drawer you fixed?
- Please add tests if possible for this and the previous PR
- This cannot happen again. It's an embarrassing failure.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #3239 +/- ##
=====================================================
+ Coverage 10.74% 90.17% +79.43%
=====================================================
Files 309 330 +21
Lines 7802 8491 +689
Branches 1729 1875 +146
=====================================================
+ Hits 838 7657 +6819
+ Misses 6900 604 -6296
- Partials 64 230 +166 ☔ View full report in Codecov by Sentry. |
Is this fixed for both screens in this PR? It looks so, but I need confirmation |
Yes, it is fixed for both the screens. |
e343b0c
into
PalisadoesFoundation:develop-postgres
What kind of change does this PR introduce?
Bugfix
Issue Number:
Fixes #3237
Did you add tests for your changes?
No, only visible changes
Snapshots/Videos:
LeftDrawerOrg_Fix.mp4
Does this PR introduce a breaking change?
No
Have you read the contributing guide?
Yes
Summary by CodeRabbit
New Features
Tests