diff --git a/CLAUDE.md b/CLAUDE.md index 2706bc2..6c49285 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,6 +61,9 @@ The plugin handles two different query scenarios: - Global `$displayed_post_ids` array accumulates IDs from rendered query loops - Subsequent query loops with `excludeDisplayed` enabled filter out tracked IDs via `post__not_in` +### Editor Viewport Placeholder (Lazy Rendering) +`withViewportPlaceholder` HOC (registered last, so it wraps the plugin's other `core/query` enhancements) replaces off-screen Query Loop blocks with a cheap `` that fires no REST request. Mounting the real block triggers the core preview fetch, so on a page with many query loops this defers those requests until each block scrolls near the viewport. An `IntersectionObserver` — constructed from the target node's own `ownerDocument.defaultView` so it works whether or not the canvas is iframed — swaps in the real block on intersection (with a 300px `rootMargin` preload). Selecting a block (e.g. right after insertion or via List View) renders it immediately, and once rendered a block stays rendered (latched via state) so scrolling away neither discards edits nor refetches. + ### Editor Preview Synchronization `withPostTemplateStyles` HOC injects an inline `