Skip to content

Add unsaved changes popup to global settings - #3198

Open
Crabcyborg wants to merge 2 commits into
masterfrom
add_unsaved_changed_popup_to_global_settings
Open

Add unsaved changes popup to global settings#3198
Crabcyborg wants to merge 2 commits into
masterfrom
add_unsaved_changed_popup_to_global_settings

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

This adds the confirmation pop-up if you update a global setting and then try to leave without saving.

When testing, we want to make sure there aren't any non-settings inputs that trigger this (like a search).

And that it actually triggers for all unsaved global settings changes.

The pop-up contents vary from browser to browser. In Firefox it looks like this.

Screenshot 2026-07-22 at 1 47 15 PM

Summary by CodeRabbit

  • Bug Fixes
    • Prevented search, add-on license, and payment-related fields from incorrectly marking global settings as having unsaved changes.
    • Improved unsaved-change tracking for other global settings fields.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Crabcyborg, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: da6084fb-489f-4418-b92c-5935cadb6a4d

📥 Commits

Reviewing files that changed from the base of the PR and between bc813bc and c94c807.

📒 Files selected for processing (2)
  • js/formidable_admin.js
  • js/src/admin/admin.js
📝 Walkthrough

Walkthrough

Adds delegated change tracking for eligible global settings fields and regenerates the compiled admin JavaScript bundle without changing its public entrypoints.

Changes

Admin settings behavior

Layer / File(s) Summary
Settings change tracking and bundle regeneration
js/src/admin/admin.js, js/formidable_admin.js
The global settings form delegates eligible input, select, and textarea changes to fieldUpdated, excludes search, addon license, and payment controls, and includes the regenerated admin bundle.

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

Suggested reviewers: garretlaxton

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an unsaved-changes prompt for global settings.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add_unsaved_changed_popup_to_global_settings

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.

@deepsource-io

deepsource-io Bot commented Jul 22, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in ddac8e5...c94c807 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Jul 31, 2026 4:58p.m. Review ↗
JavaScript Jul 31, 2026 4:58p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
js/src/admin/admin.js (1)

11375-11377: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the delegated settings handler.

Please test that search/license/payment-tab inputs do not set fieldsUpdated, while ordinary inputs, selects, and textareas do; also verify that dynamically added controls are tracked.

🤖 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 `@js/src/admin/admin.js` around lines 11375 - 11377, Add regression tests for
the delegated settings handler bound to `#form_global_settings`, covering excluded
search inputs, license-key inputs, and payment-section tabs leaving
fieldsUpdated unchanged, while ordinary inputs, selects, and textareas set it.
Also verify dynamically added matching controls trigger fieldUpdated and update
fieldsUpdated.
🤖 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.

Nitpick comments:
In `@js/src/admin/admin.js`:
- Around line 11375-11377: Add regression tests for the delegated settings
handler bound to `#form_global_settings`, covering excluded search inputs,
license-key inputs, and payment-section tabs leaving fieldsUpdated unchanged,
while ordinary inputs, selects, and textareas set it. Also verify dynamically
added matching controls trigger fieldUpdated and update fieldsUpdated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0831bc61-7288-4c01-b8c2-caddfc824614

📥 Commits

Reviewing files that changed from the base of the PR and between ddac8e5 and bc813bc.

📒 Files selected for processing (2)
  • js/formidable_admin.js
  • js/src/admin/admin.js

@garretlaxton

Copy link
Copy Markdown

This works pretty good. The only spot it doesn't popup is the Custom CSS tab. Should it trigger there?

@Crabcyborg

Copy link
Copy Markdown
Contributor Author

Thanks @garretlaxton!

The custom CSS uses code mirror, so it uses special listeners.

This should work now as well.

@garretlaxton garretlaxton 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.

This works great!

The only minor suggestion I have is disabling this for the Uninstall Formidable Forms and permanently delete all data. option on the miscellaneous tab. That way, if someone misclicks, they don't accidentally save and delete all their data. But I'll leave that up to you to decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants