Plugin

SearchFix

Fixes the annoying "We dropped the magnifying glass!" error.

index.tsx
Download

Source

src/plugins/searchFix/index.tsx
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import { Devs } from "@utils/constants";
8import definePlugin from "@utils/types";
9
10export default definePlugin({
11 name: "SearchFix",
12 description: 'Fixes the annoying "We dropped the magnifying glass!" error.',
13 settingsAboutComponent: () => <span style={{ color: "white" }}><i><b>This fix isn&#039;t perfect, so you may have to reload the search bar to fix issues.</b></i> Discord only allows a max offset of 5000 (this is what causes the magnifying glass error). This means that you can only see precisely 5000 messages into the past, and 5000 messages into the future (when sorting by old). This plugin just jumps to the opposite sorting method to try get around Discord&#039;s restriction, but if there is a large search result, and you try to view a message that is unobtainable with both methods of sorting, the plugin will simply show offset 0 (either newest or oldest message depending on the sorting method).</span>,
14 authors: [Devs.FiveCord],
15 patches: [
16 {
17 find: &#039;"SearchStore"&#039;,
18 replacement: {
19 match: /(\i)\.offset=null!==\((\i)=(\i)\.offset\)&&void 0!==(\i)\?(\i):0/i,
20 replace: (_, v, v1, query, v3, v4) => `$self.main(${query}), ${v}.offset = null !== (${v1} = ${query}.offset) && void 0 !== ${v3} ? ${v4} : 0`
21 }
22 }
23 ],
24 main(query) {
25 if (query.offset <= 5000) return;
26 query.sort_order = query.sort_order === "asc" ? "desc" : "asc";
27
28 if (query.offset > 5000 - 5000) {
29 query.offset = 0;
30 } else {
31 query.offset -= 5000;
32 }
33 }
34});
35