Skip to content

fix: Add Cancel and Add buttons to the add-row modal - #3383

Merged
mtrezza merged 2 commits into
parse-community:alphafrom
dblythy:fix/1995-add-row-modal-buttons
Jul 25, 2026
Merged

mtrezza merged 2 commits into
parse-community:alphafrom
dblythy:fix/1995-add-row-modal-buttons

Conversation

@dblythy

@dblythy dblythy commented Jul 4, 2026 •

Copy link
Copy Markdown
Member

Closes #1995

Before

Before

After

After

Summary by CodeRabbit

  • New Features

    • Enhanced the row editor dialog to better support creating new entries, including explicit “Add” and cancel/close flows.
    • Wired the dialog actions so users can save a new row or abort the add process directly from the modal.
  • Bug Fixes

    • The dialog now closes after successfully saving a newly created row.
    • Cancel/close behavior now matches the context: aborts creation for new entries and simply closes for existing ones.

@parse-github-assistant

Copy link
Copy Markdown

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant Bot changed the title fix: add Cancel and Add buttons to the add-row modal (#1995) fix: Add Cancel and Add buttons to the add-row modal (#1995) Jul 4, 2026
@parse-github-assistant

Copy link
Copy Markdown

🚀 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

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

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.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds explicit Cancel and Add behavior to the new-row modal. Browser.react.js wires save and abort callbacks, closes the dialog after saving, and EditRowDialog.react.js conditionally configures its modal actions for new objects.

Changes

New row modal dialog controls

Layer / File(s) Summary
Browser save/abort handlers and dialog wiring
src/dashboard/Data/Browser/Browser.react.js
saveNewRow closes the edit dialog after success, and renderContent passes onSaveNewRow and onAbortAddRow to EditRowDialog.
EditRowDialog Cancel/Add button behavior
src/dashboard/Data/Browser/EditRowDialog.react.js
Adds new-object detection and cancel handling; the modal shows Cancel for new rows and provides an Add action wired to onSaveNewRow.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant EditRowDialog
  participant Browser

  User->>EditRowDialog: Click "Add"
  EditRowDialog->>Browser: onSaveNewRow()
  Browser->>Browser: saveNewRow updates data and closes dialog

  User->>EditRowDialog: Click "Cancel"
  EditRowDialog->>Browser: onAbortAddRow()
  EditRowDialog->>EditRowDialog: onClose()
Loading

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 inconclusive)

Check name Status Explanation Resolution
Description check ❌ Error The description misses the required template sections, including Issue, Approach, and Tasks. Add the full template sections with an Issue link, a brief Approach summary, and the Tasks checklist.
Engage In Review Feedback ❓ Inconclusive I found the fix commit and issue, but no visible review comments/discussion to prove engagement or rejection. Provide the PR review timeline or comment thread showing feedback was discussed and then either implemented in a commit or explicitly retracted.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change and uses an allowed prefix with a capitalized summary.
Linked Issues check ✅ Passed The code adds Cancel and Add actions to the add-row modal as requested in issue #1995.
Out of Scope Changes check ✅ Passed The changes stay focused on the add-row modal behavior and related dialog wiring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed PASS: Changes are UI/state-only; no new sinks, auth logic, eval/HTML injection, or network handling were added, and save/abort reuse existing validated paths.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@dblythy
dblythy force-pushed the fix/1995-add-row-modal-buttons branch from 71be7c5 to 7558830 Compare July 4, 2026 15:59
@dblythy

dblythy commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/dashboard/Data/Browser/Browser.react.js (1)

1000-1043: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Stale selection state after successful "Add" leaves incorrect "selected rows" UI state.

addRowWithModal() sets selection = { undefined: true } when opening the modal. Previously, the dialog stayed open after save, so the (unchanged) isJustSavedObject cleanup block in renderContent() (this.setState({ selection: {} }); this.selectRow(selectedId, true);) ran on the next render and fixed the selection.

Now that saveNewRow also sets showEditRowDialog: false in the same state update that nulls newObject, the else if (this.state.showEditRowDialog) branch in renderContent() is skipped once save succeeds, so that cleanup code never runs for the modal-add flow anymore. The stale { undefined: true } selection persists indefinitely, incorrectly driving hasSelectedRows (BrowserFooter) and SelectedRowsNavigationPrompt (selectionCount > 0) after every successful "Add".

Also (lower confidence): in the relation branch, showEditRowDialog: false is applied synchronously right after obj.save() resolves, before the relation-link parent.save() completes — the modal closes before the link is actually confirmed.

🐛 Proposed fix to reset selection on close
-        const state = { data: this.state.data, showEditRowDialog: false };
+        const state = { data: this.state.data, showEditRowDialog: false, selection: {} };
         const relation = this.state.relation;
         if (relation) {
           const parent = relation.parent;
           const parentRelation = parent.relation(relation.key);
           parentRelation.add(obj);
           const targetClassName = relation.targetClassName;
           parent.save(null, { useMasterKey }).then(
             () => {
               this.setState({
                 newObject: null,
                 data: [obj, ...this.state.data],
+                selection: { [obj.id]: true },
                 relationCount: this.state.relationCount + 1,
                 counts: {
                   ...this.state.counts,
                   [targetClassName]: this.state.counts[targetClassName] + 1,
                 },
               });
             },
             error => {
               ...
             }
           );
         } else {
           state.newObject = null;
           if (this.props.params.className === obj.className) {
             this.state.data.unshift(obj);
+            state.selection = { [obj.id]: true };
           }
           this.state.counts[obj.className] += 1;
         }

         this.setState(state);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/dashboard/Data/Browser/Browser.react.js` around lines 1000 - 1043, The
Add modal flow in Browser.react.js now closes before the old selection cleanup
in renderContent() can run, so the stale selection from addRowWithModal() is
never cleared after a successful save. Update the save success path in
saveNewRow()/the obj.save() handler to explicitly reset selection when closing
the dialog (and do the same in the relation branch once the parent.save()
completes), using the existing state/update logic around showEditRowDialog,
selection, and selectRow so BrowserFooter and SelectedRowsNavigationPrompt no
longer see a phantom selected row.
🧹 Nitpick comments (1)
src/dashboard/Data/Browser/EditRowDialog.react.js (1)

227-245: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding test coverage for the new Cancel/Add modal behavior.

This introduces new interactive states (isNewObject, conditional Cancel/Close text, conditional Add button) with no accompanying test changes in the provided files. Given the stale-selection regression found in Browser.react.js's saveNewRow (see comment there), a test exercising "add row via modal → Add" would have caught it.

Also applies to: 515-521

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/dashboard/Data/Browser/EditRowDialog.react.js` around lines 227 - 245,
Add test coverage for the new modal state handling in EditRowDialog.react.js,
especially the isNewObject-driven Cancel/Add behavior and handleCancel flow.
Update or add tests around EditRowDialog and the add-row path in
Browser.react.js’s saveNewRow to exercise “add row via modal → Add” and confirm
the selected object/row state stays in sync. Make sure the test checks the
conditional button text and that Cancel calls onAbortAddRow only for new rows
while still closing the dialog.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/dashboard/Data/Browser/Browser.react.js`:
- Around line 1000-1043: The Add modal flow in Browser.react.js now closes
before the old selection cleanup in renderContent() can run, so the stale
selection from addRowWithModal() is never cleared after a successful save.
Update the save success path in saveNewRow()/the obj.save() handler to
explicitly reset selection when closing the dialog (and do the same in the
relation branch once the parent.save() completes), using the existing
state/update logic around showEditRowDialog, selection, and selectRow so
BrowserFooter and SelectedRowsNavigationPrompt no longer see a phantom selected
row.

---

Nitpick comments:
In `@src/dashboard/Data/Browser/EditRowDialog.react.js`:
- Around line 227-245: Add test coverage for the new modal state handling in
EditRowDialog.react.js, especially the isNewObject-driven Cancel/Add behavior
and handleCancel flow. Update or add tests around EditRowDialog and the add-row
path in Browser.react.js’s saveNewRow to exercise “add row via modal → Add” and
confirm the selected object/row state stays in sync. Make sure the test checks
the conditional button text and that Cancel calls onAbortAddRow only for new
rows while still closing the dialog.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 08c6b35f-71a4-4848-8c98-76bcafc1306b

📥 Commits

Reviewing files that changed from the base of the PR and between 9db24be and 7558830.

📒 Files selected for processing (2)
  • src/dashboard/Data/Browser/Browser.react.js
  • src/dashboard/Data/Browser/EditRowDialog.react.js

@mtrezza
mtrezza merged commit 2d1b739 into parse-community:alpha Jul 25, 2026
11 checks passed
@mtrezza mtrezza changed the title fix: Add Cancel and Add buttons to the add-row modal (#1995) fix: Add Cancel and Add buttons to the add-row modal Jul 25, 2026
parseplatformorg pushed a commit that referenced this pull request Jul 25, 2026
# [9.3.0-alpha.3](9.3.0-alpha.2...9.3.0-alpha.3) (2026-07-25)

### Bug Fixes

* Add Cancel and Add buttons to the add-row modal ([#1995](#1995)) ([#3383](#3383)) ([2d1b739](2d1b739))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 9.3.0-alpha.3

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jul 25, 2026
@dblythy
dblythy deleted the fix/1995-add-row-modal-buttons branch July 25, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Add row with modal" dialog has no cancel button

3 participants