File view comments disappear from the file after switching threads and coming back

Ouverte Adaptée aux débutants
#33,369 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
82/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
react, typescript
Domaine
frontend

Piste de recherche

Lisez apps/web/src/components/files/FilePreviewPanel.tsx autour de la ligne 683, puis comparez la façon dont apps/web/src/components/diffs/AnnotatableCodeView.tsx restaure les annotations depuis le magasin de brouillons du composeur. Restaurez les commentaires de fichier pour le fichier actuel en utilisant leur section et leur plage de lignes lorsque la vue est montée. Le travail est terminé lorsque les commentaires en ligne envoyés restent visibles après avoir changé de fil et être revenu au fichier.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

via-triage
What happened

After adding a line comment in the file view, it shows inline under the commented lines. After switching to another thread and back, the inline comments are gone from the file. They still exist as chips in the chat composer, but the file no longer shows which lines were commented, so you can't see what you've already said about the file.

Diagnosis

EditableFileSurface keeps inline comments in local React state that starts empty: useState<FileCommentLineAnnotation[]>([]) (apps/web/src/components/files/FilePreviewPanel.tsx:683 at v0.1.7). Submitting a comment writes it to the composer draft store (addReviewComment) and to that local state, but nothing rebuilds the local state from the store when the view mounts. Switching threads unmounts the view, so the inline comments are lost even though reviewComments in the draft store still has them.

The diff view already handles this: AnnotatableCodeView reads getComposerDraft(target)?.reviewComments and rebuilds the stored annotations (apps/web/src/components/diffs/AnnotatableCodeView.tsx:125-157). The file view could do the same for comments whose sectionId is file:<path>, using startIndex/endIndex for the line range. Current main has the same useState([]) initializer.

Steps to reproduce
  1. Open a thread in a project and open any file in the right panel's file view.
  2. Select some lines, type a comment, and submit it. The comment appears inline under those lines, and a chip appears in the composer.
  3. Switch to another thread.
  4. Switch back and look at the same file.
  5. Expected: the inline comment is still shown. Actual: it's gone, and only the composer chip remains.
Version

0.1.7 (T3 Code Desktop)

Environment

macOS 15 (Darwin 24.6.0), arm64. Desktop app against its local server.

Evidence
Source reading at v0.1.7 and `main`, as described above. No logs are involved, since this is client-side UI state.
Related issues

None found.

Fix applied or workaround

The composer chips (<file> L<a> to L<b>) still list every submitted comment, and the comments are still sent with the next message.

Filed by

Diagnosed and written by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, via T3 Code triage

Langage dominant
TypeScript
Étoiles
24.8k
Forks
6.4k
Merge moyen
8 h 26 min
PR mergées (30 j)
133

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de pingdotgg/t3code

Toutes les issues de pingdotgg/t3code

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.