Fix feed transition keys

This commit is contained in:
josedario87
2025-06-10 00:02:05 -06:00
parent 0d2ffee841
commit 9ce5300741
2 changed files with 8 additions and 3 deletions

View File

@@ -36,7 +36,12 @@ export const useRealtimeStore = defineStore('realtime', {
// store event for feed with View Transition if available
const addEvent = () => {
this.events.unshift({ ...payload, receivedAt: new Date().toISOString() });
const event = {
id: crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).slice(2),
...payload,
receivedAt: new Date().toISOString(),
};
this.events.unshift(event);
};
if (document.startViewTransition) {
document.startViewTransition(addEvent);

View File

@@ -23,8 +23,8 @@ onMounted(() => {
style="max-height: calc(100vh - 160px); min-width: 60vw;"
>
<RealtimeEventCard
v-for="(ev, idx) in realtime.events"
:key="ev.receivedAt + idx"
v-for="ev in realtime.events"
:key="ev.id"
:event="ev"
style="max-width: 100%; border-bottom: white 1px solid; padding: 20px 0 40px 20px ;"
/>