FIX: Prevent browser refresh when clicking search menu result (#23881)

This commit is contained in:
Mark VanLandingham 2023-10-10 13:05:13 -05:00 committed by GitHub
parent 7f580a3083
commit d4399b4f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,6 @@
import Component from "@glimmer/component";
import DiscourseURL from "discourse/lib/url";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
@ -20,7 +22,13 @@ export default class Types extends Component {
}
@action
onClick() {
onClick(event) {
if (wantsNewWindow(event)) {
return;
}
event.preventDefault();
DiscourseURL.routeTo(event.currentTarget.href);
this.args.closeSearchMenu();
}