perf: opening a channel no longer loads its pinned messages in the background (#35293)

Every time a channel opened, its pinned messages were fetched even though the Pinned Messages dialog was closed, and that result was thrown away when the dialog loaded them again on open. They now load only when the dialog opens. Requests for pinned messages, counted in the browser over the same clicks:

<table>
<tr><th>Step</th><th>Before</th><th>After</th></tr>
<tr><td>Open a channel</td><td>1</td><td>0</td></tr>
<tr><td>Switch to another channel</td><td>1</td><td>0</td></tr>
<tr><td>Open the Pinned Messages dialog</td><td>2</td><td>2</td></tr>
</table>

Fixes #35292
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-30 18:27:16 +04:00
1 parent 294c0e988d
commit 2e94968a9a
1 file changed
+1 -5
@@ -1,6 +1,6 @@
<script lang="ts">
import { toast } from 'svelte-sonner';
import { getContext, onMount } from 'svelte';
import { getContext } from 'svelte';
const i18n = getContext('i18n');
import { getChannelPinnedMessages, pinMessage } from '$lib/apis/channels';
@@ -60,10 +60,6 @@
$: if (show) {
init();
}
onMount(() => {
init();
});
</script>
{#if channel}