Show preview sessions and add overridable template blocks - #39
Conversation
|
|
||
| var exitLink = doc.createElement('a'); | ||
| exitLink.className = 'spark-preview-indicator__exit'; | ||
| exitLink.href = '/?deactivate-theme=true'; |
There was a problem hiding this comment.
WARNING: Exiting preview discards the current storefront location
This hard-coded root URL sends a merchant previewing a product, cart, or other deep link back to the homepage. Preserve the current path (and any relevant non-preview query/hash state) while adding the deactivation parameter so the exit action returns them to the same page outside preview.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| {% endblock platform_compatibility %} | ||
|
|
||
| {% block preview_indicator %} | ||
| <script type="text/javascript" src="{{ 'js/spark-preview.js'|asset_url }}"></script> |
There was a problem hiding this comment.
WARNING: The preview script is loaded for every storefront visit
The feature self-gates only after this global asset has already been requested, parsed, and executed, so ordinary visitors are not actually untouched and the documented minimal global script set gains a fifth file. Render this script tag only when the preview cookie/session is present, or otherwise load it without adding an unconditional request to every page.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| r"{%\s*endverbatim(?:\s+.*?)?\s*%}", | ||
| re.DOTALL, | ||
| ) | ||
| BLOCK_RE = re.compile(r"{%\s*block\s+([\w-]+)(?:\s|%})") |
There was a problem hiding this comment.
WARNING: Required-block detection does not verify balanced block structure
This regex only collects opening block names, so deleting or misspelling an endblock still satisfies the new integrity gate even though layouts/base.html would no longer be a valid template. Since this check is intended to protect extension points, parse matching block/endblock pairs (including named closers) or otherwise validate template syntax rather than checking opening-tag presence alone.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Overview
The incremental diff (commit Files Reviewed (2 files in incremental diff)
Previous Review Summaries (2 snapshots, latest commit d10c1ff)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit d10c1ff)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (2 files in incremental diff)
Fix these issues in Kilo Cloud Previous review (commit e339c60)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (7 files)
Reviewed by minimax-m3 · Input: 26.1K · Output: 2.2K · Cached: 168K |
| else: | ||
| try: | ||
| base_text = mask_ignored_regions(base_template.read_text(encoding="utf-8")) | ||
| base_blocks, block_errors = inspect_block_structure(base_text) |
There was a problem hiding this comment.
WARNING: Block-structure validation only runs against layouts/base.html
inspect_block_structure is invoked solely on base_text, so misspelled or unclosed {% block %} / {% endblock %} tags in templates/ and partials/ still pass the integrity gate even though they would break template inheritance just as easily. The previous review called for parsing matching block/endblock pairs to protect extension points; running the same check on every template path would actually deliver that. Either call inspect_block_structure for each template path collected in template_paths(root) (and surface per-file errors), or restrict the gate's wording so it does not claim to validate template syntax beyond base.html.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
This adds a small preview banner with an Exit preview link. It appears only when the preview cookie is present and does not affect normal visitors.
The PR also:
Checks pass: 34 Python tests, the JavaScript suites, theme settings and template checks, Sass compatibility, and CSS drift.