From 3350ae651d527ea54a63f08b1a1d9bf94278b3ae Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sun, 7 Jun 2026 10:45:48 +0300 Subject: [PATCH] return filepath.SkipDir instead of nil for excluded dir entries --- CHANGELOG.md | 6 ++++-- plugins/jsvm/jsvm.go | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5500f565..d0240b07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ -## v0.39.2 (WIP) +## v0.39.2 - Fixed records list UI sorting ([#7724](https://github.com/pocketbase/pocketbase/issues/7724)). - Don't clear the date input on invalid value while still typing ([#7726](https://github.com/pocketbase/pocketbase/issues/7726)). -- Updated `modernc.org/sqlite` to v1.52.0 ([SQLite 3.53.2](https://sqlite.org/releaselog/3_53_2.html)). +- Return `filepath.SkipDir` in the `pb_hooks` dirs watcher to avoid unnecessery iterating over `node_modules` and `.*` prefixed hidden dirs (e.g. `.DS_store`, `.git`, etc.). + +- Updated `modernc.org/sqlite` to v1.52.0 ([SQLite 3.53.2](https://sqlite.org/src/timeline?from=version-3.53.0&to=version-3.53.2&to2=branch-3.53&y=ci)). ## v0.39.1 diff --git a/plugins/jsvm/jsvm.go b/plugins/jsvm/jsvm.go index d61aef3d..c26330aa 100644 --- a/plugins/jsvm/jsvm.go +++ b/plugins/jsvm/jsvm.go @@ -443,11 +443,16 @@ func (p *plugin) watchHooks() error { // // @todo replace once recursive watcher is added (https://github.com/fsnotify/fsnotify/issues/18) dirsErr := filepath.WalkDir(watchDir, func(path string, entry fs.DirEntry, err error) error { - // skip access failures, hidden directories, node_modules, etc. - if err != nil || !entry.IsDir() || entry.Name() == "node_modules" || strings.HasPrefix(entry.Name(), ".") { + // ignore access failures and non-dir entries + if err != nil || !entry.IsDir() { return nil } + // skip traversing hidden directories and node_modules + if strings.HasPrefix(entry.Name(), ".") || entry.Name() == "node_modules" { + return filepath.SkipDir + } + return watcher.Add(path) }) if dirsErr != nil {