Skip to content

feat: re-watch new docs_dir when kwelea.toml changes during serve #40

Description

@engineervix

Summary

addDirRecursive is called once at startup with the original cfg.Build.DocsDir. If docs_dir is changed in kwelea.toml while kwelea serve is running, the config reloads correctly (fixed in #39) but the fsnotify watcher still watches the old directory tree. Edits under the new docs_dir won't trigger rebuilds until the server restarts.

Current behaviour

  1. Start kwelea serve — watcher covers docs/
  2. Edit kwelea.toml: docs_dir = "content/docs"
  3. Config reloads, next rebuild uses content/docs
  4. Edit a file under content/docs/no rebuild fires

Expected behaviour

After a docs_dir change is picked up from kwelea.toml, the watcher should stop watching the old tree and start watching the new one.

Proposed solution

In watch, after a successful config reload, compare old and new DocsDir. If changed:

  • Remove the old tree from the watcher (or close and recreate the watcher)
  • Call addDirRecursive with the new DocsDir

Origin

Surfaced during review of PR #39. Noted by the reviewer as pre-existing behaviour, not introduced by that PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions