Skip to content

Commit

Permalink
ハッシュタグTLを離れた時にchannelを切断 (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
kozakura913 authored Jul 3, 2024
2 parents 74072e7 + bdae182 commit b8dfb6e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/frontend/src/pages/tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { computed, ref } from 'vue';
import { computed, onUnmounted, ref } from 'vue';
import * as Misskey from 'cherrypick-js';
import MkNotes from '@/components/MkNotes.vue';
import MkButton from '@/components/MkButton.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js';
Expand Down Expand Up @@ -57,14 +58,18 @@ async function post() {
const headerActions = computed(() => []);

const headerTabs = computed(() => []);
let connection: Misskey.ChannelConnection | null = null;

definePageMetadata(() => ({
title: props.tag,
icon: 'ti ti-hash',
}));
onUnmounted(() => {
connection?.dispose();
});

function openStream() {
const connection = stream.useChannel('hashtag', {
connection = stream.useChannel('hashtag', {
q: [[props.tag]],
});
connection.on('note', note => {
Expand Down

0 comments on commit b8dfb6e

Please sign in to comment.