Skip to content

Commit

Permalink
fix(core): correctly handle overrides of watch flag for caching
Browse files Browse the repository at this point in the history
Previously if the --watch flag were being overridden, when attempting to determine if a given task is long-running, we would perform a !!value check against the override. Since overrides are passed through as strings, if a --watch override was provided at all, the task would be marked as long running -- even if the override was disabling watch mode.

This has a side effect of the Nx Cloud runner not persisting task outputs to the remote cache, causing any task with a --watch override running in DTE to fail.
  • Loading branch information
StalkAltan authored and vsavkin committed Aug 4, 2022
1 parent b6bbd41 commit dc46534
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/nx/src/tasks-runner/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ export function isCacheableTask(
function longRunningTask(task: Task) {
const t = task.target.target;
return (
!!task.overrides['watch'] || t === 'serve' || t === 'dev' || t === 'start'
(!!task.overrides['watch'] && task.overrides['watch'] !== 'false') ||
t === 'serve' ||
t === 'dev' ||
t === 'start'
);
}

Expand Down

0 comments on commit dc46534

Please sign in to comment.