fix: Add delete control for file fields in the edit dialog (#1832)#3396
fix: Add delete control for file fields in the edit dialog (#1832)#3396dblythy wants to merge 1 commit into
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Closes #1832
Problem
Under the modern UI, a File field in the row edit modal can be downloaded and replaced but not
removed with a click. The pre-3.2.0 UI had a Delete button; it was dropped, and the modal offers no
way to unset a file (only the data-browser
Deletekey unsets a field). This matches the issue'sfinal diagnosis that the modal "behaves differently than the data browser" and needs a per-field
unset affordance.
Fix
Add a "Delete file" control (a
Pill, rendered only when a file exists) next to "Change file" in theEditRowDialogFile case. It unsets via the existing path:handleChange(undefined, name)->updateRow(row, name, undefined)->Parse.Object.unset()-> save, i.e. exactly the same "unset"contract the data-browser
Deletekey already uses, so behaviour is consistent.Also removes the now-superseded dead code in
FileEditor(removeFile()and thefileInputRefitwas the sole reader of): that method already did
onCommit(undefined)but was never wired toanything, and since
FileEditorrendersdisplay:none(it is a headless native-picker trigger),the delete control belongs in the dialog where the file UI is actually visible.
Scope: the inline data-browser File cell already supports unset via the
Deletekey, so only themodal needed a click affordance.
Verification
Added
src/lib/tests/EditRowDialog.test.js(red->green): asserts the "Delete file" Pill renders onlywhen a file is present and that clicking it calls
updateRow(row, name, undefined).Runtime, class
TestFileswith aphotoFile column holding an uploaded file, opened viaEdit > "Edit this row with modal":
Before: the File field shows only the download arrow + "Change file"; no way to delete the file.
After: a "Delete file" control appears next to "Change file".
Clicking "Delete file" unsets the field (shows "Select file"; the cell reads "(undefined)" and the
server no longer returns the
photokey):