[Rt-commit] rt branch, 4.6/search-selection-next, updated. rt-4.4.4-726-g06b3eb4f41

Blaine Motsinger blaine at bestpractical.com
Tue Feb 4 18:38:12 EST 2020


The branch, 4.6/search-selection-next has been updated
       via  06b3eb4f417502fa7b5d38179c8a414f5de1e980 (commit)
      from  033072132d5898cbbcbebd688f09258ed5834d0c (commit)

Summary of changes:
 share/static/js/forms.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 06b3eb4f417502fa7b5d38179c8a414f5de1e980
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Tue Feb 4 17:34:50 2020 -0600

    Force redirect back to the current page on submit
    
    If the user submits a post to "reset to default", then immediately
    a post to save new changes, the JS was instructing the browser to
    reload which then submitted the reset post again.
    
    Instead of reload, the JS now redirects back to the current page
    to clear out the previous post "state" so not to immediately reset
    the new changes.

diff --git a/share/static/js/forms.js b/share/static/js/forms.js
index 95848550ac..392db900ae 100644
--- a/share/static/js/forms.js
+++ b/share/static/js/forms.js
@@ -179,7 +179,15 @@ jQuery(function() {
                 timeout: 30000, /* 30 seconds */
                 success: function (response) {
                     if (response.ok) {
-                        window.location.reload();
+                        // force redirect back to the current page after submitting the form.
+                        // this does two things.
+                        // first, we ensure the preferences in the page are current with the database.
+                        // second, we reset last operation in the browser cache for the page so it's not holding a previous post.
+                        // if the user "resets to defaults", that operation would otherwise stay cached.
+                        // so when the user then saves new values, two posts are done; one to save new values, and one
+                        // to reset them again, effectively wiping out the changes they just made.
+                        var current_location = window.location;
+                        window.location.replace( current_location );
                     }
                     else {
                         alert(response.msg);

-----------------------------------------------------------------------


More information about the rt-commit mailing list