fix(core): do not destructure potential null value in watch callback

This commit is contained in:
Jonathan Cammisuli 2023-05-29 14:07:14 -04:00 committed by Victor Savkin
parent b12586551b
commit 4398932d0e

View File

@ -520,13 +520,13 @@ function debounce(fn: (...args) => void, time: number) {
function createFileWatcher() {
return daemonClient.registerFileWatcher(
{ watchProjects: 'all', includeGlobalWorkspaceFiles: true },
debounce(async (error, { changedFiles }) => {
debounce(async (error, changes) => {
if (error === 'closed') {
output.error({ title: `Watch error: Daemon closed the connection` });
process.exit(1);
} else if (error) {
output.error({ title: `Watch error: ${error?.message ?? 'Unknown'}` });
} else if (changedFiles.length > 0) {
} else if (changes !== null && changes.changedFiles.length > 0) {
output.note({ title: 'Recalculating project graph...' });
const newGraphClientResponse = await createDepGraphClientResponse();