fix(folders): remove stale column/metric refs from folders on delete#38302
Conversation
When a calculated column or metric was removed in the dataset editor, its UUID remained in the folder structure. The backend's validate_folders rejected the stale UUID with a 422 error, making it impossible to save. - Add filterFoldersByValidUuids to treeUtils (reference-stable) - Use it in DatasourceEditor.onChange to clean the API payload - Sync FoldersEditor internal state via useEffect on columns/metrics - Add uuid field to local Column interface Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review Agent Run #572d09Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
Bito Automatic Review Skipped – PR Already Merged |
SUMMARY
When a calculated column or metric is removed in the dataset editor, its UUID remains in the folder structure. The backend's
validate_foldersrejects the stale UUID with a 422 error, making it impossible to save the dataset.This PR filters stale column/metric references from folders when columns or metrics change:
treeUtils.ts— AddfilterFoldersByValidUuids()that recursively removes leaf items whose UUIDs are not in the valid set. Returns the original reference when nothing was removed (avoids unnecessary re-renders).DatasourceEditor.tsx— UsefilterFoldersByValidUuidsinonChange()to clean the API payload before propagating to the parent. Also adds missinguuidfield to the localColumninterface.FoldersEditor/index.tsx— AdduseEffectto sync internal folder state when columns/metrics change externally, so the UI immediately reflects removed items.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
Screen.Recording.2026-02-27.at.16.37.36.mov
After:
Screen.Recording.2026-02-27.at.16.41.09.mov
TESTING INSTRUCTIONS
DATASET_FOLDERSfeature flagADDITIONAL INFORMATION
DATASET_FOLDERS