-
Notifications
You must be signed in to change notification settings - Fork 6
fix: loading of labels indicator #298
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
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds a centered "No labels" DropdownMenuLabel to LabelsFilter when no labels exist. Removes Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as LabelsFilter UI
participant NP as NotesProvider (Context)
participant HL as useLabels Hook
participant L as LocalNotes
participant R as RemoteNotes
UI->>NP: mount / read context
NP->>L: load local notes
NP->>R: load remote notes
L-->>NP: localReady
R-->>NP: remoteReady
NP->>NP: notesReady = localReady && remoteReady
NP->>HL: useLabels(allNotes)
HL-->>NP: { filteredNotes, labels, toggleLabel } %% labelsAreLoaded removed
NP-->>UI: Context { filteredNotes, labels, notesReady, toggleLabel }
UI->>UI: if treeRoots.length == 0 render "No labels" label
UI->>NP: toggleLabel(id)
NP->>HL: toggleLabel(id)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
✅ Deploy Preview for graypaper-reader ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 (3)
src/components/LabelsFilter/LabelsFilter.tsx (1)
90-90: Gate empty-state by load readiness and use Tailwind 4.x opacity syntax.Avoid showing “No labels” while loading; also replace non-core opacity-65 with opacity-[0.65].
- {treeRoots.length === 0 && <DropdownMenuLabel className="text-center opacity-65">No labels</DropdownMenuLabel>} + {labelsAreLoaded && treeRoots.length === 0 && ( + <DropdownMenuLabel className="text-center opacity-[0.65]">No labels</DropdownMenuLabel> + )}src/components/NotesProvider/hooks/useLabels.ts (2)
112-112: Remove leftover sentinel; it’s no longer needed.Now that labelsAreLoaded was dropped, the unknown[] sentinel adds type risk without value.
-const initialEmptyArray: unknown[] = [];
124-124: Initialize labels with a plain, typed empty array.Simplifies state and typing.
- const [labels, setLabels] = useState<ILabelTreeNode[]>(initialEmptyArray as ILabelTreeNode[]); + const [labels, setLabels] = useState<ILabelTreeNode[]>([]);
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
src/components/LabelsFilter/LabelsFilter.tsx(2 hunks)src/components/NotesProvider/NotesProvider.tsx(2 hunks)src/components/NotesProvider/hooks/useLabels.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}
⚙️ CodeRabbit configuration file
When reviewing Tailwind CSS classes, ensure they follow Tailwind 4.x conventions and suggest modern 4.x alternatives for deprecated patterns.
Files:
src/components/NotesProvider/hooks/useLabels.tssrc/components/LabelsFilter/LabelsFilter.tsxsrc/components/NotesProvider/NotesProvider.tsx
🧬 Code graph analysis (2)
src/components/LabelsFilter/LabelsFilter.tsx (1)
src/components/ui/dropdown-menu.tsx (1)
DropdownMenuLabel(169-169)
src/components/NotesProvider/NotesProvider.tsx (1)
src/components/NotesProvider/hooks/useLabels.ts (1)
useLabels(118-237)
🔇 Additional comments (4)
src/components/LabelsFilter/LabelsFilter.tsx (1)
6-6: Import addition looks good.DropdownMenuLabel is properly imported from the shared UI.
src/components/NotesProvider/hooks/useLabels.ts (1)
236-236: Approved: useLabels API change and cleanup verified
- Confirmed that all calls to
useLabels(...)only destructurefilteredNotes,labels, andtoggleLabel—there are no remaining destructures oflabelsAreLoadedfromuseLabels.- References to
labelsAreLoadedinNotesProvider.tsxandLabelsFilter.tsxcome from context props (sourced fromallNotesReady), not the hook return value, and remain correct.src/components/NotesProvider/NotesProvider.tsx (2)
97-97: Updated useLabels destructure aligns with new API.No reliance on removed labelsAreLoaded from the hook.
108-108: Deriving labelsAreLoaded from allNotesReady is sensible and consistent.Keeps UI gating tied to notes readiness.
Summary by CodeRabbit
New Features
Bug Fixes
Style