perf: ♻️ Use global instance of composable instead of an instance per component for identities, client and settings

This commit is contained in:
Jesse Wierzbinski 2024-07-21 15:33:32 +02:00
parent f1ada1745d
commit 3428e4b5b6
No known key found for this signature in database
38 changed files with 104 additions and 131 deletions

View file

@ -60,7 +60,6 @@ const { Control_Enter, Command_Enter, Control_Alt } = useMagicKeys();
const content = ref("");
const respondingTo = ref<Status | null>(null);
const respondingType = ref<"reply" | "quote" | "edit" | null>(null);
const identity = useCurrentIdentity();
const cw = ref(false);
const cwContent = ref("");
const markdown = ref(true);
@ -178,7 +177,6 @@ const canSubmit = computed(
(content.value?.trim().length > 0 || files.value.length > 0) &&
content.value?.trim().length <= characterLimit.value,
);
const client = useClient();
const send = async () => {
loading.value = true;

View file

@ -19,7 +19,6 @@ defineProps<{
textarea: HTMLTextAreaElement | undefined;
}>();
const identity = useCurrentIdentity();
const emojis = computed(
() =>
identity.value?.emojis.map((emoji) => ({

View file

@ -74,7 +74,6 @@ const files = defineModel<
required: true,
});
const client = useClient();
const fileInput = ref<HTMLInputElement | null>(null);
const openFilePicker = () => {

View file

@ -18,7 +18,6 @@ const props = defineProps<{
textarea: HTMLTextAreaElement | undefined;
}>();
const client = useClient();
const mentions = ref<{ key: string; value: Account }[]>([]);
watch(

View file

@ -34,7 +34,6 @@ import { Dialog } from "@ark-ui/vue";
import Composer from "./composer.vue";
const open = ref(false);
const identity = useCurrentIdentity();
useListen("note:reply", async (note) => {
open.value = true;
await nextTick();