From a208c1b054f6941182ec8beb69d7eb6338f3ddec Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Tue, 28 Mar 2023 11:01:47 -0500 Subject: [PATCH] FIX: Reset results on query redirect (#236) # Problem When switching group reports it was possible to have the `results` from a previous run (of a query) pass over to the rendering of a different query. # Fix Set the controllers `results` to `null` when first rendering the query https://user-images.githubusercontent.com/50783505/228050384-5231f004-1dc2-4867-8d57-9db7706bb65f.mov --- .../discourse/routes/group-reports-index.js | 7 ------- .../discourse/routes/group-reports-show.js | 13 ++----------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/assets/javascripts/discourse/routes/group-reports-index.js b/assets/javascripts/discourse/routes/group-reports-index.js index ca9f455..8b4d8a8 100644 --- a/assets/javascripts/discourse/routes/group-reports-index.js +++ b/assets/javascripts/discourse/routes/group-reports-index.js @@ -1,6 +1,5 @@ import { ajax } from "discourse/lib/ajax"; import DiscourseRoute from "discourse/routes/discourse"; -import { action } from "@ember/object"; export default class GroupReportsIndexRoute extends DiscourseRoute { model() { @@ -27,10 +26,4 @@ export default class GroupReportsIndexRoute extends DiscourseRoute { setupController(controller, model) { controller.setProperties(model); } - - @action - refreshModel() { - this.refresh(); - return false; - } } diff --git a/assets/javascripts/discourse/routes/group-reports-show.js b/assets/javascripts/discourse/routes/group-reports-show.js index 8acc4c3..027e445 100644 --- a/assets/javascripts/discourse/routes/group-reports-show.js +++ b/assets/javascripts/discourse/routes/group-reports-show.js @@ -1,6 +1,5 @@ import { ajax } from "discourse/lib/ajax"; import DiscourseRoute from "discourse/routes/discourse"; -import { action } from "@ember/object"; export default class GroupReportsShowRoute extends DiscourseRoute { model(params) { @@ -20,6 +19,8 @@ export default class GroupReportsShowRoute extends DiscourseRoute { model: Object.assign({ params: queryParams }, query), group, queryGroup, + results: null, + showResults: false, }; }) .catch(() => { @@ -30,14 +31,4 @@ export default class GroupReportsShowRoute extends DiscourseRoute { setupController(controller, model) { controller.setProperties(model); } - - deactivate() { - this.controller.showResults = false; - } - - @action - refreshModel() { - this.refresh(); - return false; - } }