From a1659e1c0278962ea1a4b4a188add5aae538ce42 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Mon, 30 May 2022 21:10:11 -0700 Subject: [PATCH] add @babel/plugin-transform-runtime, fix scrolling on chan switch/history loading --- babel.config.cjs | 1 + client/components/Chat.vue | 24 ++----- client/components/ChatInput.vue | 4 +- client/components/ChatUserList.vue | 4 +- client/components/DateMarker.vue | 13 +++- client/components/Mentions.vue | 9 +-- client/components/Message.vue | 2 +- client/components/MessageList.vue | 72 +++++++++++---------- client/components/NetworkForm.vue | 8 +-- client/components/NetworkList.vue | 8 +-- client/components/Windows/SearchResults.vue | 16 ++--- client/js/router.ts | 11 ++-- client/js/socket-events/init.ts | 5 +- client/js/socket-events/more.ts | 12 ++-- package.json | 1 + src/client.ts | 4 -- src/models/chan.ts | 4 +- src/plugins/auth.ts | 4 -- src/plugins/auth/ldap.ts | 32 ++++----- src/plugins/irc-events/link.ts | 8 +-- src/plugins/irc-events/message.ts | 30 ++++++--- src/plugins/messageStorage/sqlite.ts | 3 - src/types/socket-events.d.ts | 8 ++- yarn.lock | 12 ++++ 24 files changed, 147 insertions(+), 148 deletions(-) diff --git a/babel.config.cjs b/babel.config.cjs index eff106a3..022d859a 100644 --- a/babel.config.cjs +++ b/babel.config.cjs @@ -5,5 +5,6 @@ module.exports = { "@babel/preset-typescript", // ? babel-preset-typescript-vue should be a drop-in replacement for @babel/typescript with vue support // "@vue/babel-preset-jsx", ], + plugins: ["@babel/plugin-transform-runtime"], targets: "> 0.25%, not dead", }; diff --git a/client/components/Chat.vue b/client/components/Chat.vue index 31f542ab..f79c6668 100644 --- a/client/components/Chat.vue +++ b/client/components/Chat.vue @@ -105,7 +105,6 @@ :network="network" :channel="channel" :focused="focused" - @scrolled-to-bottom="onScrolledToBottom" /> @@ -175,10 +174,6 @@ export default defineComponent({ return undefined; }); - const onScrolledToBottom = (data: boolean) => { - props.channel.scrolledToBottom = data; - }; - const channelChanged = () => { // Triggered when active channel is set or changed emit("channel-changed", props.channel); @@ -234,21 +229,15 @@ export default defineComponent({ }); }; - watch( - () => props.channel, - () => { - channelChanged(); - } - ); + watch(props.channel, () => { + channelChanged(); + }); const editTopicRef = ref(props.channel.editTopic); watch(editTopicRef, (newTopic) => { if (newTopic) { - nextTick(() => { + void nextTick(() => { topicInput.value?.focus(); - }).catch((e) => { - // eslint-disable-next-line no-console - console.error(e); }); } }); @@ -257,10 +246,8 @@ export default defineComponent({ channelChanged(); if (props.channel.editTopic) { - nextTick(() => { + void nextTick(() => { topicInput.value?.focus(); - }).catch(() => { - // no-op }); } }); @@ -271,7 +258,6 @@ export default defineComponent({ topicInput, specialComponent, editTopicRef, - onScrolledToBottom, hideUserVisibleError, editTopic, saveTopic, diff --git a/client/components/ChatInput.vue b/client/components/ChatInput.vue index b20983d7..a0dc9695 100644 --- a/client/components/ChatInput.vue +++ b/client/components/ChatInput.vue @@ -102,7 +102,7 @@ export default defineComponent({ const autocompletionRef = ref>(); const setInputSize = () => { - nextTick(() => { + void nextTick(() => { if (!input.value) { return; } @@ -120,8 +120,6 @@ export default defineComponent({ input.value.style.height = `${ Math.ceil(input.value.scrollHeight / lineHeight) * lineHeight }px`; - }).catch(() => { - // no-op }); }; diff --git a/client/components/ChatUserList.vue b/client/components/ChatUserList.vue index 24d61f8a..d3bcab98 100644 --- a/client/components/ChatUserList.vue +++ b/client/components/ChatUserList.vue @@ -175,11 +175,9 @@ export default defineComponent({ const scrollToActiveUser = () => { // Scroll the list if needed after the active class is applied - nextTick(() => { + void nextTick(() => { const el = userlist.value?.querySelector(".active"); el?.scrollIntoView({block: "nearest", inline: "nearest"}); - }).catch(() => { - // no-op }); }; diff --git a/client/components/DateMarker.vue b/client/components/DateMarker.vue index 7cccfa35..b1b8e23c 100644 --- a/client/components/DateMarker.vue +++ b/client/components/DateMarker.vue @@ -9,7 +9,14 @@