From e50f3df6a041733899c4ad0f6123b0472d548e70 Mon Sep 17 00:00:00 2001 From: Tim Hostetler <6970899+thostetler@users.noreply.github.com> Date: Tue, 20 Oct 2020 23:36:59 -0400 Subject: [PATCH] Fix history loop issue with /search When an error occurs on the route /search, it defaults back to index page. But this error will happen with any bare (no params) search, so you can get into a loop where the back button is constantly re-pushing the index-page. This now replaces the history entry on error, which should fix it. --- src/js/apps/discovery/router.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/apps/discovery/router.js b/src/js/apps/discovery/router.js index e41147ef6..4202d29af 100644 --- a/src/js/apps/discovery/router.js +++ b/src/js/apps/discovery/router.js @@ -29,6 +29,8 @@ define([ execute: function(callback, args) { + console.log(Backbone.history); + if (_.isFunction(callback)) { callback.apply(this, args); } @@ -126,7 +128,7 @@ define([ ); } } else { - this.getPubSub().publish(this.getPubSub().NAVIGATE, 'index-page'); + this.getPubSub().publish(this.getPubSub().NAVIGATE, 'index-page', { replace: true }); } },