feat: Add folder organization system for feature flags (#271)#323
feat: Add folder organization system for feature flags (#271)#323MrLawrenceKwan wants to merge 1 commit intodatabuddy-analytics:mainfrom
Conversation
- Add optional 'folder' field to flags table schema with indexes - Update API endpoints to support folder filtering and CRUD - Create FolderSelector component for folder management - Integrate folder selection into flag creation/editing sheet - Update validation schemas to include folder field Implements databuddy-analytics#271 - Feature Flag Folders bounty
|
@MrLawrenceKwan is attempting to deploy a commit to the Databuddy OSS Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
|
Greptile SummaryAdded folder organization system for feature flags. The implementation includes a new optional Key Changes:
Issues Found:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User creates/edits flag] --> B[FlagSheet form]
B --> C[FolderSelector component]
C --> D{User action?}
D -->|Search existing| E[CommandInput filters list]
D -->|Select folder| F[Set flag.folder = selected]
D -->|Type in bottom input| G[Set newFolderName state]
G --> H[Click create button]
H --> I[Set flag.folder = newFolderName]
E --> J{Match found?}
J -->|Yes| F
J -->|No| K[CommandEmpty shown]
K --> L{newFolderName populated?}
L -->|No| M[Only shows 'No folders found']
L -->|Yes| N[Shows create button]
F --> O[Submit flag form]
I --> O
O --> P[API: flags.create/update]
P --> Q[Validate folder max 255]
Q --> R[Save to DB with folder field]
R --> S[Query flags with folder filter]
S --> T[Display organized flags]
Last reviewed commit: 81d6891 |
| <CommandInput placeholder="Search folders..." /> | ||
| <CommandList> | ||
| <CommandEmpty> | ||
| <div className="space-y-2 p-2"> | ||
| <p className="text-muted-foreground text-sm">No folders found</p> | ||
| {newFolderName && ( | ||
| <Button | ||
| className="w-full gap-2" | ||
| onClick={handleCreateFolder} | ||
| size="sm" | ||
| > | ||
| <PlusIcon className="size-4" /> | ||
| Create "{newFolderName}" | ||
| </Button> | ||
| )} |
There was a problem hiding this comment.
CommandInput has its own internal search state that filters the folder list, but newFolderName state (line 38) is only set by the separate input field at the bottom (lines 143-156). When a user types "my-folder" in the CommandInput and no folders match, the CommandEmpty section shows but the create button won't appear because newFolderName is empty. To fix this, either use useCommandState() hook from cmdk to access the search value, or add an onValueChange handler to CommandInput to sync with newFolderName.
| <input | ||
| className="flex-1 rounded border bg-background px-3 py-1.5 text-sm outline-none focus:border-primary" | ||
| onChange={(e) => setNewFolderName(e.target.value)} | ||
| onKeyDown={(e) => { | ||
| if (e.key === "Enter") { | ||
| e.preventDefault(); | ||
| handleCreateFolder(); | ||
| } | ||
| }} | ||
| placeholder="New folder name..." | ||
| value={newFolderName} | ||
| /> |
There was a problem hiding this comment.
Missing maxLength={255} validation on the input field. The backend validates folder names to max 255 chars, but users can type beyond this limit here, leading to a validation error only after submission.
Summary
Implements #271 - Feature Flag Folders bounty
Adds a folder organization system for feature flags to help users manage large numbers of flags.
Changes
Database Schema
foldertext field to flags tableAPI Changes
flags.listendpoint to support folder filteringflags.createandflags.updateto handle folder fieldUI Changes
FolderSelectorcomponent for folder managementTesting
Screenshots
Will add once I can run the dashboard locally
Notes