From f37cfeb6b42d82287313201d5e433a35cb29024d Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Fri, 24 Nov 2023 17:43:07 +0800 Subject: [PATCH] fix(ui): fix message card rendering issue https://svelte.dev/tutorial/keyed-each-blocks #83 --- ui/src/routes/requests/[request_id]/+page.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/src/routes/requests/[request_id]/+page.svelte b/ui/src/routes/requests/[request_id]/+page.svelte index 1ac45ab3..dff2d4cf 100644 --- a/ui/src/routes/requests/[request_id]/+page.svelte +++ b/ui/src/routes/requests/[request_id]/+page.svelte @@ -38,6 +38,11 @@ return 0; }) || []; + + sortedMessages.reverse().forEach(function(item ,index){ + item.id = index; + }) + sortedMessages.reverse(); } $: { @@ -87,7 +92,7 @@ /> {/if} - {#each sortedMessages as message} + {#each sortedMessages as message (message.id)} {/each}