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
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:
@@ -452,18 +452,20 @@ function zoomOut() {
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if activeAnnotationId}
|
||||
<AnnotationCommentPanel
|
||||
documentId={documentId}
|
||||
annotationId={activeAnnotationId}
|
||||
canComment={canComment ?? false}
|
||||
currentUserId={currentUserId ?? null}
|
||||
canAdmin={canAdmin ?? false}
|
||||
onClose={() => (activeAnnotationId = null)}
|
||||
onCountChange={(count) => {
|
||||
if (activeAnnotationId) commentCounts.set(activeAnnotationId, count);
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{#key activeAnnotationId}
|
||||
{#if activeAnnotationId}
|
||||
<AnnotationCommentPanel
|
||||
documentId={documentId}
|
||||
annotationId={activeAnnotationId}
|
||||
canComment={canComment ?? false}
|
||||
currentUserId={currentUserId ?? null}
|
||||
canAdmin={canAdmin ?? false}
|
||||
onClose={() => (activeAnnotationId = null)}
|
||||
onCountChange={(count) => {
|
||||
if (activeAnnotationId) commentCounts.set(activeAnnotationId, count);
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{/key}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user