only override the search on the frontend if its not already been handled by the backend to prevent duplicate queries

This commit is contained in:
Daniel Klabbers 2021-11-10 13:36:34 +01:00
parent 8111c214cc
commit bad10ef03d
3 changed files with 22 additions and 20 deletions

2
js/dist/forum.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,9 @@ import DiscussionListState from 'flarum/forum/states/DiscussionListState';
export default function extendDiscussionState() {
override(DiscussionListState.prototype, 'loadPage', async function (this: DiscussionListState, original, page: number = 1) {
if (!this.requestParams()?.filter?.q) return original.call(this, page);
const preloaded = app.preloadedApiDocument() || null;
if (preloaded || !this.requestParams()?.filter?.q) return original.call(this, page);
const params = this.requestParams();
params.page = {