fix(application): improve watch paths handling by trimming and filtering empty paths to prevent unnecessary triggers

This commit is contained in:
Andras Bacsai
2025-09-15 13:59:14 +02:00
parent 6d56b83e27
commit 7eb0c5a757

View File

@@ -1563,7 +1563,19 @@ class Application extends BaseModel
if (is_null($this->watch_paths)) {
return false;
}
$watch_paths = collect(explode("\n", $this->watch_paths));
$watch_paths = collect(explode("\n", $this->watch_paths))
->map(function (string $path): string {
return trim($path);
})
->filter(function (string $path): bool {
return strlen($path) > 0;
});
// If no valid patterns after filtering, don't trigger
if ($watch_paths->isEmpty()) {
return false;
}
$matches = $modified_files->filter(function ($file) use ($watch_paths) {
return $watch_paths->contains(function ($glob) use ($file) {
return fnmatch($glob, $file);