Skip to content

feat: add validation when updating/creating notes that at least one label must be added#359

Merged
chmurson merged 6 commits intomainfrom
fix-adding-or-updateing-note-without-any-label
Dec 30, 2025
Merged

feat: add validation when updating/creating notes that at least one label must be added#359
chmurson merged 6 commits intomainfrom
fix-adding-or-updateing-note-without-any-label

Conversation

@chmurson
Copy link
Collaborator

@chmurson chmurson commented Dec 30, 2025

Summary by CodeRabbit

  • New Features
    • Added label validation requiring at least one label per note before saving.
    • Added error messages displayed when labels are missing, automatically clearing when labels are properly selected.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Label validation logic has been added to the NewNote and Note components to ensure at least one label is selected before saving. The changes introduce a new noteLabelsError state, validation checks during the save workflow, error state clearing when labels are modified or in edit mode, and UI rendering of label validation messages.

Changes

Cohort / File(s) Summary
Label Validation Logic
src/components/NoteManager/components/NewNote.tsx, src/components/NoteManager/components/Note.tsx
Added noteLabelsError state to track label validation errors. Implemented handleLabelsChange callback to clear errors when labels are populated. Enhanced save workflow to validate that at least one label exists, preventing save and displaying validation message if none are selected. Validation errors reset on edit start, save initiation, cancel, and when labels are updated.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


🐰 With labels now guarded well,
No empty notes shall break the spell,
At least one tag must have its place,
Before we save with peaceful grace!
🏷️✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f81668 and c882f24.

📒 Files selected for processing (2)
  • src/components/NoteManager/components/NewNote.tsx
  • src/components/NoteManager/components/Note.tsx

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@chmurson chmurson changed the base branch from fix-adding-new-note-when-filtering-hides-it to main December 30, 2025 22:16
@netlify
Copy link

netlify bot commented Dec 30, 2025

Deploy Preview for graypaper-reader ready!

Name Link
🔨 Latest commit c882f24
🔍 Latest deploy log https://app.netlify.com/projects/graypaper-reader/deploys/69544f5c9f7efd0008f5d375
😎 Deploy Preview https://deploy-preview-359--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.

@chmurson chmurson merged commit 380ece8 into main Dec 30, 2025
8 of 9 checks passed
@chmurson chmurson deleted the fix-adding-or-updateing-note-without-any-label branch December 30, 2025 22:18
@github-actions
Copy link
Contributor

Visual Regression Test Report ✅ Passed

Github run id: 20607076937

🔗 Artifacts: Download

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