diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2026-02-15 12:08:10 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-15 12:08:10 +0900 |
| commit | 799f5ab50421bf6bed20146b13d6c2ca230874f3 (patch) | |
| tree | 23edbd7edcb51870c8e8f221b464e3b76f3a28f8 | |
| parent | Bump version to 2026.2.0-alpha.0 (diff) | |
| download | misskey-799f5ab50421bf6bed20146b13d6c2ca230874f3.tar.gz misskey-799f5ab50421bf6bed20146b13d6c2ca230874f3.tar.bz2 misskey-799f5ab50421bf6bed20146b13d6c2ca230874f3.zip | |
enhance(frontend): いくつかのtodoの解消 (#17154)
| -rw-r--r-- | packages/frontend/src/components/MkPostForm.vue | 26 | ||||
| -rw-r--r-- | packages/frontend/src/stream.ts | 1 |
2 files changed, 21 insertions, 6 deletions
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 72a7f4a01c..d709286041 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -114,7 +114,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed, useTemplateRef, onUnmounted } from 'vue'; +import { watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed, useTemplateRef, onUnmounted, onBeforeUnmount } from 'vue'; import * as mfm from 'mfm-js'; import * as Misskey from 'misskey-js'; import insertTextAtCursor from 'insert-text-at-cursor'; @@ -227,6 +227,10 @@ const targetChannel = shallowRef(props.channel); const serverDraftId = ref<string | null>(null); const postFormActions = getPluginHandlers('post_form_action'); +let textAutocomplete: Autocomplete | null = null; +let cwAutocomplete: Autocomplete | null = null; +let hashtagAutocomplete: Autocomplete | null = null; + const uploader = useUploader({ multiple: true, }); @@ -1408,10 +1412,9 @@ onMounted(() => { }); } - // TODO: detach when unmount - if (textareaEl.value) new Autocomplete(textareaEl.value, text); - if (cwInputEl.value) new Autocomplete(cwInputEl.value, cw); - if (hashtagsInputEl.value) new Autocomplete(hashtagsInputEl.value, hashtags); + if (textareaEl.value) textAutocomplete = new Autocomplete(textareaEl.value, text); + if (cwInputEl.value) cwAutocomplete = new Autocomplete(cwInputEl.value, cw); + if (hashtagsInputEl.value) hashtagAutocomplete = new Autocomplete(hashtagsInputEl.value, hashtags); nextTick(() => { // 書きかけの投稿を復元 @@ -1468,6 +1471,19 @@ onMounted(() => { }); }); +onBeforeUnmount(() => { + uploader.abortAll(); + if (textAutocomplete) { + textAutocomplete.detach(); + } + if (cwAutocomplete) { + cwAutocomplete.detach(); + } + if (hashtagAutocomplete) { + hashtagAutocomplete.detach(); + } +}); + async function canClose() { if (!uploader.allItemsUploaded.value) { const { canceled } = await os.confirm({ diff --git a/packages/frontend/src/stream.ts b/packages/frontend/src/stream.ts index adbde3fee2..4e6917e0af 100644 --- a/packages/frontend/src/stream.ts +++ b/packages/frontend/src/stream.ts @@ -18,7 +18,6 @@ let lastHeartbeatCall = 0; export function useStream(): Misskey.IStream { if (stream) return stream; - // TODO: No Websocketモードもここで判定 stream = markRaw(new Misskey.Stream(wsOrigin, $i ? { token: $i.token, } : null)); |