From c008443f2d668f270415f907f1818f458814d646 Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Tue, 5 Nov 2019 11:24:52 +0000 Subject: [PATCH] FIX: filterQueryParams mutates state that is essentially global Let's prevent it from doing this by duplicating the input first. --- .../javascripts/discourse/routes/build-topic-route.js.es6 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 index e892876dfe3..fb4249205d0 100644 --- a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 @@ -4,7 +4,8 @@ import { defaultHomepage } from "discourse/lib/utilities"; // A helper to build a topic route for a filter function filterQueryParams(params, defaultParams) { - const findOpts = defaultParams || {}; + const findOpts = Object.assign({}, defaultParams || {}); + if (params) { Object.keys(queryParams).forEach(function(opt) { if (params[opt]) {