summaryrefslogtreecommitdiff
path: root/packages/client/src/components
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2021-11-26 13:43:11 +0900
committerGitHub <noreply@github.com>2021-11-26 13:43:11 +0900
commit8e0108a0b83c6f1fb9021ed8aeb051d46d34c382 (patch)
tree880e8146fa44822784d9ce0c721c6b9b3dd42ac7 /packages/client/src/components
parentfix: toolsが動かないのを修正 (#8008) (diff)
downloadmisskey-8e0108a0b83c6f1fb9021ed8aeb051d46d34c382.tar.gz
misskey-8e0108a0b83c6f1fb9021ed8aeb051d46d34c382.tar.bz2
misskey-8e0108a0b83c6f1fb9021ed8aeb051d46d34c382.zip
fix: notification.vueのIntersectionObserverまわりを修正 (#8010)
* fix notification.vue * remove a blank line * disconnect intersection observer * disconnect2 * Update packages/client/src/components/notification.vue Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * disconnect * oops Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Diffstat (limited to 'packages/client/src/components')
-rw-r--r--packages/client/src/components/notification.vue21
1 files changed, 9 insertions, 12 deletions
diff --git a/packages/client/src/components/notification.vue b/packages/client/src/components/notification.vue
index 89025b72e6..5cf44f4c56 100644
--- a/packages/client/src/components/notification.vue
+++ b/packages/client/src/components/notification.vue
@@ -107,28 +107,25 @@ export default defineComponent({
const reactionRef = ref(null);
onMounted(() => {
- let readObserver: IntersectionObserver | null = null;
- let connection = null;
-
if (!props.notification.isRead) {
- readObserver = new IntersectionObserver((entries, observer) => {
+ const readObserver = new IntersectionObserver((entries, observer) => {
if (!entries.some(entry => entry.isIntersecting)) return;
os.stream.send('readNotification', {
id: props.notification.id
});
- entries.map(({ target }) => observer.unobserve(target));
+ observer.disconnect();
});
readObserver.observe(elRef.value);
- connection = os.stream.useChannel('main');
- connection.on('readAllNotifications', () => readObserver.unobserve(elRef.value));
- }
+ const connection = os.stream.useChannel('main');
+ connection.on('readAllNotifications', () => readObserver.disconnect());
- onUnmounted(() => {
- if (readObserver) readObserver.unobserve(elRef.value);
- if (connection) connection.dispose();
- });
+ onUnmounted(() => {
+ readObserver.disconnect();
+ connection.dispose();
+ });
+ }
});
const followRequestDone = ref(false);