fix(comments): remount AnnotationCommentPanel when switching annotations
Some checks failed
CI / Unit & Component Tests (push) Failing after 2m13s
CI / Backend Unit Tests (push) Successful in 2m23s
CI / E2E Tests (push) Failing after 24m41s
CI / Unit & Component Tests (pull_request) Failing after 2m8s
CI / Backend Unit Tests (pull_request) Successful in 2m8s
CI / E2E Tests (pull_request) Has been cancelled

Wrap the panel in {#key activeAnnotationId} so Svelte destroys and
recreates it on every annotation change, triggering onMount and
loading the correct comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-24 11:28:44 +01:00
parent af57b4e530
commit fd03e56c85

View File

@@ -452,18 +452,20 @@ function zoomOut() {
{/if} {/if}
</div> </div>
{#if activeAnnotationId} {#key activeAnnotationId}
<AnnotationCommentPanel {#if activeAnnotationId}
documentId={documentId} <AnnotationCommentPanel
annotationId={activeAnnotationId} documentId={documentId}
canComment={canComment ?? false} annotationId={activeAnnotationId}
currentUserId={currentUserId ?? null} canComment={canComment ?? false}
canAdmin={canAdmin ?? false} currentUserId={currentUserId ?? null}
onClose={() => (activeAnnotationId = null)} canAdmin={canAdmin ?? false}
onCountChange={(count) => { onClose={() => (activeAnnotationId = null)}
if (activeAnnotationId) commentCounts.set(activeAnnotationId, count); onCountChange={(count) => {
}} if (activeAnnotationId) commentCounts.set(activeAnnotationId, count);
/> }}
{/if} />
{/if}
{/key}
</div> </div>
{/if} {/if}