mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 14:34:19 +02:00
refactor(frontend): ID生成処理を統一
This commit is contained in:
@@ -70,11 +70,12 @@ import { definePage } from '@/page.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { PREF_DEF } from '@/preferences/def.js';
|
||||
import { getInitialPrefValue } from '@/preferences/manager.js';
|
||||
import { genId } from '@/utility/id.js';
|
||||
|
||||
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
|
||||
|
||||
const items = ref(prefer.s.menu.map(x => ({
|
||||
id: Math.random().toString(),
|
||||
id: genId(),
|
||||
type: x,
|
||||
})));
|
||||
|
||||
@@ -93,7 +94,7 @@ async function addItem() {
|
||||
});
|
||||
if (canceled) return;
|
||||
items.value = [...items.value, {
|
||||
id: Math.random().toString(),
|
||||
id: genId(),
|
||||
type: item,
|
||||
}];
|
||||
}
|
||||
@@ -108,7 +109,7 @@ async function save() {
|
||||
|
||||
function reset() {
|
||||
items.value = getInitialPrefValue('menu').map(x => ({
|
||||
id: Math.random().toString(),
|
||||
id: genId(),
|
||||
type: x,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -796,6 +796,7 @@ import { globalEvents } from '@/events.js';
|
||||
import { claimAchievement } from '@/utility/achievements.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import { ensureSignin } from '@/i.js';
|
||||
import { genId } from '@/utility/id.js';
|
||||
|
||||
const $i = ensureSignin();
|
||||
|
||||
@@ -1009,7 +1010,7 @@ let smashTimer: number | null = null;
|
||||
|
||||
function testNotification(): void {
|
||||
const notification: Misskey.entities.Notification = {
|
||||
id: Math.random().toString(),
|
||||
id: genId(),
|
||||
createdAt: new Date().toUTCString(),
|
||||
isRead: false,
|
||||
type: 'test',
|
||||
|
||||
@@ -171,6 +171,7 @@ import { claimAchievement } from '@/utility/achievements.js';
|
||||
import { store } from '@/store.js';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
import MkTextarea from '@/components/MkTextarea.vue';
|
||||
import { genId } from '@/utility/id.js';
|
||||
|
||||
const $i = ensureSignin();
|
||||
|
||||
@@ -199,12 +200,12 @@ watch(() => profile, () => {
|
||||
deep: true,
|
||||
});
|
||||
|
||||
const fields = ref($i.fields.map(field => ({ id: Math.random().toString(), name: field.name, value: field.value })) ?? []);
|
||||
const fields = ref($i.fields.map(field => ({ id: genId(), name: field.name, value: field.value })) ?? []);
|
||||
const fieldEditMode = ref(false);
|
||||
|
||||
function addField() {
|
||||
fields.value.push({
|
||||
id: Math.random().toString(),
|
||||
id: genId(),
|
||||
name: '',
|
||||
value: '',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user