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
This commit is contained in:
Isaac Janzen 2023-03-28 11:01:47 -05:00 committed by GitHub
parent f589864ce1
commit a208c1b054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 18 deletions

View File

@ -1,6 +1,5 @@
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import { action } from "@ember/object";
export default class GroupReportsIndexRoute extends DiscourseRoute { export default class GroupReportsIndexRoute extends DiscourseRoute {
model() { model() {
@ -27,10 +26,4 @@ export default class GroupReportsIndexRoute extends DiscourseRoute {
setupController(controller, model) { setupController(controller, model) {
controller.setProperties(model); controller.setProperties(model);
} }
@action
refreshModel() {
this.refresh();
return false;
}
} }

View File

@ -1,6 +1,5 @@
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import { action } from "@ember/object";
export default class GroupReportsShowRoute extends DiscourseRoute { export default class GroupReportsShowRoute extends DiscourseRoute {
model(params) { model(params) {
@ -20,6 +19,8 @@ export default class GroupReportsShowRoute extends DiscourseRoute {
model: Object.assign({ params: queryParams }, query), model: Object.assign({ params: queryParams }, query),
group, group,
queryGroup, queryGroup,
results: null,
showResults: false,
}; };
}) })
.catch(() => { .catch(() => {
@ -30,14 +31,4 @@ export default class GroupReportsShowRoute extends DiscourseRoute {
setupController(controller, model) { setupController(controller, model) {
controller.setProperties(model); controller.setProperties(model);
} }
deactivate() {
this.controller.showResults = false;
}
@action
refreshModel() {
this.refresh();
return false;
}
} }