fix(search): clear searchUnchanged at start of every view()

Move the one-tick searchUnchanged flag to the top of view() so full and
light polls both consume it once before async work begins.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-23 08:21:16 -04:00
co-authored by Cursor
parent 7ebb5b945c
commit 5188f6ea28
+3 -5
View File
@@ -9760,6 +9760,8 @@ class PearcordPlatform extends EventEmitter {
async view (opts = {}) {
const light = !!opts.light
const searchUnchangedForView = !!this._searchUnchanged
if (this._searchUnchanged) this._searchUnchanged = false
const user = this.identity.user
const guild = this.mode === 'guild' ? (this.guild?.guild || null) : null
let channels = []
@@ -10645,11 +10647,7 @@ class PearcordPlatform extends EventEmitter {
)
: [],
searchScope: this._searchScope,
searchUnchanged: (() => {
const flag = !!this._searchUnchanged
if (this._searchUnchanged) this._searchUnchanged = false
return flag
})(),
searchUnchanged: searchUnchangedForView,
forumIncludeArchived: this._forumIncludeArchived,
searchResults: await this._resolveSearchResults({ light }),
searchResultsCached: !!this._lastSearchFromCache,