fix: chats ui socket navigation

This commit is contained in:
trisua 2025-04-29 16:58:42 -04:00
parent 0304461389
commit 0dbf660399

View file

@ -96,6 +96,7 @@
<a
class="w-full justify-start button {% if selected_channel == channel.id %}quaternary{% else %}camo{% endif %}"
href="/chats/{{ selected_community }}/{{ channel.id }}"
data-turbo="{{ selected_community == '0' }}"
>
{{ icon "rss" }}
<b class="name shortest">{{ channel.title }}</b>
@ -443,7 +444,6 @@
</script>
<script id="socket_init" data-turbo-permanent="true">
window.SUBSCRIBE_CHANNEL = "{{ selected_community }}" === "0";
globalThis.socket_init = () => {
if (window.socket) {
window.socket.send("Close");
@ -482,6 +482,8 @@
{% if selected_channel %}
<script>
window.SUBSCRIBE_CHANNEL = "{{ selected_community }}" === "0";
setTimeout(() => {
if (!window.SUBSCRIBE_CHANNEL) {
// sub community
@ -494,7 +496,7 @@
socket_init();
}
}
}, 50);
}, 100);
setTimeout(() => {
window.socket.addEventListener("message", async (event) => {