Skip to content

Commit

Permalink
fix: loadActual cleanup
Browse files Browse the repository at this point in the history
While looking at the target setter for nodes, it seemed odd that we were
making affordances for sometimes setting a promise as the target.  After
unraveling the code, it turns out this is impossible outside of tests,
where we set environment variables to mimic that state.  We were always
awaiting the generation of links/nodes where appropriate. This commit
inlines some code and cleans it up to the point where this fact could be
verified, and then removes the now unneeded logic in loadActual that was
trying to account for this.  loadActual, an async function, now returns
a promise that resolves to the tree, as a singleton. This maintains the
use case commented on where buildIdealTree and reify can happen in
parallel.

This fixes a potential bug in reify (and likely others) which pass
around this.idealTree as an object, and NOT a promise, even though
before this refactor it can sometimes be a promise.
  • Loading branch information
wraithgar committed Sep 8, 2022
1 parent 49bbb2f commit 2db6c08
Showing 1 changed file with 196 additions and 233 deletions.
Loading

0 comments on commit 2db6c08

Please sign in to comment.