Bump content sentinel on delete to trigger Astro loader re-run

This commit is contained in:
brutsalvadi
2026-04-23 22:50:58 +02:00
parent 848685ad8f
commit 6056d255a1
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -200,11 +200,17 @@ def _save(slug: str, body: PageBody, base: Path) -> JSONResponse:
path.write_text(body.content, encoding="utf-8") path.write_text(body.content, encoding="utf-8")
return JSONResponse({"slug": slug, "saved": True}) return JSONResponse({"slug": slug, "saved": True})
_SENTINEL = site_dir / "src" / "_content-sentinel.ts"
def _delete(slug: str, base: Path) -> JSONResponse: def _delete(slug: str, base: Path) -> JSONResponse:
path = _slug_to_path(slug, base) path = _slug_to_path(slug, base)
if not path.exists(): if not path.exists():
raise HTTPException(404, "Not found") raise HTTPException(404, "Not found")
path.unlink() path.unlink()
# Bump the sentinel to force Astro to re-run all content loaders.
# macOS fsevents never fires unlink events through symlinks, so deleted
# entries stay in the store until a loader re-run prunes them.
_SENTINEL.write_text(f"export const _t = {int(time.time())};\n")
return JSONResponse({"slug": slug, "deleted": True}) return JSONResponse({"slug": slug, "deleted": True})
+1 -1
Submodule site updated: 3ccd551149...079460a7fa