Skip to content

FileService.onDidFilesChange emits duplicate identical events for a single file change #16520

@YueCHEN195

Description

@YueCHEN195

Bug Description:
When listening to the FileService's onDidFilesChange event in FileTreeModel ([file-tree-model.ts] the same file change event is emitted multiple times for a single file creation. I added a debug log in onFilesChanged and observed duplicate, identical events for newly created files.

Steps to Reproduce:

  1. In file-tree-model.ts (class FileTreeModel), add the following line inside onFilesChanged to log incoming events:
    console.log('File changes detected:', changes);
Image
  1. Open any workspace, create several .txt files in the workspace, and open these files in the editor.
Image
  1. Observe the developer console / terminal output. The "File changes detected" log appears multiple times for the same file creation event (the logged changes payloads are identical).
Image

Observed Behavior:
The onDidFilesChange event handler receives duplicate identical FileChangesEvent notifications for a single file creation. Each duplicate contains the same change data.

Expected Behavior:
The onDidFilesChange event should be emitted once per actual filesystem change. The file creation should produce a single FileChangesEvent reporting the new resource.

Additional Information:
Operating System: Windows 11
Theia Version: 1.65.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbugs found in the applicationfilesystemissues related to the filesystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions