1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-02 17:55:52 +02:00

refactor(frontend): ID生成処理を統一

This commit is contained in:
syuilo
2025-06-03 07:37:08 +09:00
parent 3bc81522c6
commit 93d17aff6c
16 changed files with 35 additions and 20 deletions

View File

@@ -52,6 +52,7 @@ import type { SuggestionType } from '@/utility/autocomplete.js';
import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js';
import { Autocomplete } from '@/utility/autocomplete.js';
import { genId } from '@/utility/id.js';
const props = defineProps<{
modelValue: string | number | null;
@@ -87,7 +88,7 @@ const emit = defineEmits<{
const { modelValue, type, autofocus } = toRefs(props);
const v = ref(modelValue.value);
const id = Math.random().toString(); // TODO: uuid?
const id = genId();
const focused = ref(false);
const changed = ref(false);
const invalid = ref(false);

View File

@@ -57,6 +57,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, onUnmounted, ref, useTemplateRef } from 'vue';
import { genId } from '@/utility/id.js';
const particles = ref<{
id: string,
@@ -86,7 +87,7 @@ onMounted(() => {
const y = (Math.random() * (height.value - 64));
const sizeFactor = Math.random();
const particle = {
id: Math.random().toString(),
id: genId(),
x,
y,
size: 0.2 + ((sizeFactor / 10) * 3),

View File

@@ -29,6 +29,7 @@ import { i18n } from '@/i18n.js';
import { globalEvents } from '@/events.js';
import { $i } from '@/i.js';
import MkNote from '@/components/MkNote.vue';
import { genId } from '@/utility/id.js';
const props = defineProps<{
phase: 'aboutNote' | 'howToReact';
@@ -83,7 +84,7 @@ function doNotification(emoji: string): void {
if (!$i || !emoji) return;
const notification: Misskey.entities.Notification = {
id: Math.random().toString(),
id: genId(),
createdAt: new Date().toUTCString(),
type: 'reaction',
reaction: emoji,