diff -r 3ea38fd469ca -r 6d75fa09cc0c src/documentmanager.cpp --- a/src/documentmanager.cpp Sun Jul 03 23:54:22 2022 +0300 +++ b/src/documentmanager.cpp Mon Jul 04 00:19:18 2022 +0300 @@ -335,6 +335,7 @@ QObject::connect(model, &Model::dataChanged, modelModified); QObject::connect(model, &Model::rowsInserted, modelModified); QObject::connect(model, &Model::rowsRemoved, modelModified); + QObject::connect(model, &Model::modelReset, modelModified); } } @@ -403,12 +404,17 @@ std::map& missing) { bool repeat = true; + const auto olddeps = info->dependencies; info->dependencies.clear(); while (repeat) { repeat = false; const std::set dependencies = resolveReferencePaths(info, libraries); for (const Dependency& dep : dependencies) { - if (not info->dependencies.contains(dep.name) and not missing.contains(dep.path)) { + const ModelId* const idp = findInMap(olddeps, dep.name); + if (idp != nullptr) { + info->dependencies[dep.name] = *idp; + } + else if (not info->dependencies.contains(dep.name) and not missing.contains(dep.path)) { QString loadErrorString; QTextStream localErrorStream{&loadErrorString}; const std::optional modelIdOpt = documents->openModel( @@ -417,7 +423,7 @@ OpenType::AutomaticallyOpened); if (not modelIdOpt.has_value()) { const QString& errorMessage = QObject::tr("could not load '%1': %2") - .arg(dep.path, loadErrorString); + .arg(dep.path, loadErrorString); missing[dep.path] = errorMessage; } else {