Skip to content

Conversation

@chmurson
Copy link
Collaborator

@chmurson chmurson commented Aug 27, 2025

Summary by CodeRabbit

  • New Features

    • Shows an explicit "No labels" message at the top of the Labels filter dropdown when no labels exist.
  • Bug Fixes

    • Labels availability now respects overall notes readiness, avoiding premature/incorrect label displays.
  • Style

    • Empty-state text centered and subtly dimmed for clearer, less distracting feedback.

@coderabbitai
Copy link

coderabbitai bot commented Aug 27, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a centered "No labels" DropdownMenuLabel to LabelsFilter when no labels exist. Removes labelsAreLoaded from the public return of useLabels and from INotesContext; LabelsFilter now uses notesReady from NotesContext and passes it to the dumb component. No other API exports changed.

Changes

Cohort / File(s) Summary of Changes
LabelsFilter UI
src/components/LabelsFilter/LabelsFilter.tsx
Import DropdownMenuLabel; render a centered, semi-opaque "No labels" label at the top of DropdownMenuContent when treeRoots.length === 0. Use notesReady from context and pass labelsAreLoaded={notesReady ?? false} to the dumb component. No selection/toggle logic changes.
NotesProvider
src/components/NotesProvider/NotesProvider.tsx
Stop exposing labelsAreLoaded from useLabels(allNotes); NotesContext no longer includes labelsAreLoaded as part of the INotesContext public shape. Provider continues to surface readiness via notesReady (consumed by UI).
useLabels hook
src/components/NotesProvider/hooks/useLabels.ts
Remove labelsAreLoaded from the hook return signature; rename internal sentinel emptyArrayinitialEmptyArray and initialize labels with it. Return only { filteredNotes, labels, toggleLabel }.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • DrEverr
  • mateuszsikora

Poem

A rabbit nudged the dropdown bright,
"No labels" now sits in center light.
Hooks trimmed tidy, context clear,
NotesReady guides the UI here.
Hop—toggle—bounce—🥕🐇


📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 6f8a303 and 510c341.

📒 Files selected for processing (2)
  • src/components/LabelsFilter/LabelsFilter.tsx (3 hunks)
  • src/components/NotesProvider/NotesProvider.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-endless-labels-loading

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link

netlify bot commented Aug 27, 2025

Deploy Preview for graypaper-reader ready!

Name Link
🔨 Latest commit 510c341
🔍 Latest deploy log https://app.netlify.com/projects/graypaper-reader/deploys/68b0513858f7350008a92983
😎 Deploy Preview https://deploy-preview-298--graypaper-reader.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 746a7ae and cdcf267.

📒 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.ts
  • src/components/LabelsFilter/LabelsFilter.tsx
  • src/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 destructure filteredNotes, labels, and toggleLabel—there are no remaining destructures of labelsAreLoaded from useLabels.
  • References to labelsAreLoaded in NotesProvider.tsx and LabelsFilter.tsx come from context props (sourced from allNotesReady), 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.

@chmurson chmurson changed the title tswfix: loading of labels indicator fix: loading of labels indicator Aug 28, 2025
@chmurson chmurson merged commit aca0e38 into main Aug 28, 2025
6 of 8 checks passed
@chmurson chmurson deleted the fix-endless-labels-loading branch August 28, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant