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:
parent
8111c214cc
commit
bad10ef03d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -6,7 +6,9 @@ import DiscussionListState from 'flarum/forum/states/DiscussionListState';
|
||||||
|
|
||||||
export default function extendDiscussionState() {
|
export default function extendDiscussionState() {
|
||||||
override(DiscussionListState.prototype, 'loadPage', async function (this: DiscussionListState, original, page: number = 1) {
|
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();
|
const params = this.requestParams();
|
||||||
params.page = {
|
params.page = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue