diff --git a/src/lib/components/comments/CommentHighlights.svelte b/src/lib/components/comments/CommentHighlights.svelte index 9dd24d4548..a211cf2a57 100644 --- a/src/lib/components/comments/CommentHighlights.svelte +++ b/src/lib/components/comments/CommentHighlights.svelte @@ -412,39 +412,41 @@ > {draft.anchor.quote} - {#key `${resourceQuery(draft.options)}:${draft.options.target_id}:${draft.anchor.surface_id}:${draft.anchor.start}:${draft.anchor.end}`} - { - const created = await commentsRequest('/', 'POST', { - resource_type: draft.options.resource_type, - resource_id: draft.options.resource_id, - target_type: draft.options.target_type, - target_id: draft.options.target_id, - anchor: draft.anchor, - content, - temp_id - }); - if (!mounted || $commentSelectionDraft !== draft) return; - postedComment = created; - records = { - ...records, - [resourceQuery(created)]: [ - ...(records[resourceQuery(created)] ?? []).filter( - (item) => item.id !== created.id - ), - created - ] - }; - }} - /> - {/key} +
+ {#key `${resourceQuery(draft.options)}:${draft.options.target_id}:${draft.anchor.surface_id}:${draft.anchor.start}:${draft.anchor.end}`} + { + const created = await commentsRequest('/', 'POST', { + resource_type: draft.options.resource_type, + resource_id: draft.options.resource_id, + target_type: draft.options.target_type, + target_id: draft.options.target_id, + anchor: draft.anchor, + content, + temp_id + }); + if (!mounted || $commentSelectionDraft !== draft) return; + postedComment = created; + records = { + ...records, + [resourceQuery(created)]: [ + ...(records[resourceQuery(created)] ?? []).filter( + (item) => item.id !== created.id + ), + created + ] + }; + }} + /> + {/key} +
{/if} {#each hovered as { comment } (comment.id)}