nx
nx copied to clipboard
fix(core): invalidate sync generator cache on file changes and use up-to-date project graph
Current Behavior
Sync generators are processed in the background by the daemon server. Their results are cached and reprocessed when the project graph is recomputed. There are currently two issues:
- The cache is only invalidated after the project graph finishes recomputing, which means that there's an interval between files changed (triggering the project graph recomputation) and the recomputation finishes, where the cache is not invalidated, and it's stale. During that interval, any request to get the sync generator changes will use the stale cache.
- Sync generators are scheduled to be processed after the project graph is recomputed, so a quick succession of recomputations can be coalesced. The problem is that the scheduled closure uses the project graph from the initial scheduling, rather than the latest available project graph at the time it runs. This results in the usage of stale data to process the sync generators.
Expected Behavior
Getting sync generators changes should always return up-to-date information.