QmlDesigner: Fix ProjectStoragePathWatcher::checkForChangeInDirectory

The ids should be unique.

Change-Id: Idee63b4631ca24602553af4caecb49bec7c97d69
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2025-04-04 13:13:55 +02:00
parent 5c3f3cc592
commit 3a052a4d48
2 changed files with 3 additions and 1 deletions

View File

@@ -88,6 +88,8 @@ public:
void checkForChangeInDirectory(SourceContextIds sourceContextIds) override void checkForChangeInDirectory(SourceContextIds sourceContextIds) override
{ {
std::ranges::sort(sourceContextIds); std::ranges::sort(sourceContextIds);
auto removed = std::ranges::unique(sourceContextIds);
sourceContextIds.erase(removed.begin(), removed.end());
addChangedPathForFilePath(sourceContextIds); addChangedPathForFilePath(sourceContextIds);
} }

View File

@@ -433,7 +433,7 @@ TEST_F(ProjectStoragePathWatcher, trigger_manual_two_notify_file_changes)
ElementsAre(IdPaths{projectChunkId1, {sourceIds[0], sourceIds[1]}}, ElementsAre(IdPaths{projectChunkId1, {sourceIds[0], sourceIds[1]}},
IdPaths{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}}))); IdPaths{projectChunkId2, {sourceIds[0], sourceIds[1], sourceIds[3]}})));
watcher.checkForChangeInDirectory({sourceIds[0].contextId(), sourceIds[1].contextId()}); watcher.checkForChangeInDirectory({sourceIds[0].contextId(), sourceIds[2].contextId()});
} }
TEST_F(ProjectStoragePathWatcher, trigger_manual_notify_for_path_changes) TEST_F(ProjectStoragePathWatcher, trigger_manual_notify_for_path_changes)