fix(journal): re-publish only changed declarations

topoSortAffected followed declared dependencies even when they were not in the affected set, so reevaluateDependents re-evaluated and re-published variables that had not changed. This could also overwrite a value just set via /set with the declaration's own expression.
This commit is contained in:
hyper
2026-09-12 23:44:06 +08:00
parent f17f09a8c4
commit 3532be2335
3 changed files with 28 additions and 4 deletions
+4 -1
View File
@@ -797,7 +797,10 @@ function topoSortAffected(affected: Set<string>): string[] {
if (expr) {
const deps = extractDependencies(expr);
for (const dep of deps) {
if (affected.has(dep) || declExprs!.has(dep)) {
// Only order within the affected set. Declared dependencies that did
// not change must not be pulled in, or reevaluateDependents would
// re-publish variables that were never touched.
if (affected.has(dep)) {
visit(dep);
}
}