| @@ -234,7 +234,15 @@ | ||
| 234 | 234 | $bd_nested_depth--; |
| 235 | 235 | |
| 236 | 236 | if ( $bd_is_outermost ) { |
| 237 | 237 | $bd_html = ob_get_clean(); |
| 238 | - set_transient( $bd_cache_key, $bd_html, HOUR_IN_SECONDS * 6 ); | |
| 238 | + // Never cache an empty render. An empty buffer means every child term was | |
| 239 | + // skipped ( $_counts <= 0 ), which is usually a transient data state — stale | |
| 240 | + // counts mid-import, docs not yet published. The read guard treats '' as a hit | |
| 241 | + // ( '' !== false ), so caching it would pin a blank nested block for 6 hours | |
| 242 | + // after the data is already correct. Re-rendering once per request while empty | |
| 243 | + // is what lets it self-heal. (#165) | |
| 244 | + if ( '' !== $bd_html ) { | |
| 245 | + set_transient( $bd_cache_key, $bd_html, HOUR_IN_SECONDS * 6 ); | |
| 246 | + } | |
| 239 | 247 | echo $bd_html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 240 | 248 | } |