Skip to content

Fix preview errors - #661

Merged
uldisrudzitis merged 3 commits into
masterfrom
fix-preview-errors
Oct 8, 2026
Merged

uldisrudzitis merged 3 commits into
masterfrom
fix-preview-errors

Conversation

@uldisrudzitis

@uldisrudzitis uldisrudzitis commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Preview loading now waits for the page body to be available and handles navigation to a new document without treating the previous page as ready.
    • After page layouts, entries, or site settings are updated, page interactions are refreshed so entry creation and related actions continue to work.
    • Preview loading reports an error if the page body does not become available within the wait period.

uldisrudzitis and others added 2 commits October 8, 2026 16:19
After replacing preview content, the editor removed the last
.xCreateNewEntry in the page before dispatching addEntry. BertaEditor
already replaces the link after the entries list on addEntry, so the
removal was redundant, and it threw on pages without any such link
(no entries list, messy grid view), which stopped addEntry from being
dispatched. It also deleted the last entry's own link when the rerender
ran before BertaEditor had added the one after the list.

Rerenders now only dispatch addEntry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@uldisrudzitis uldisrudzitis self-assigned this Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95e0a310-ae61-4a21-b071-336eb84ba444
📥 Commits

Reviewing files that changed from the base of the PR and between cbd15de and d73034c.

📒 Files selected for processing (8)
  • editor/src/app/rerender/common/page-layout.service.ts
  • editor/src/app/rerender/default-template-rerender.service.ts
  • editor/src/app/rerender/mashup/page-layout.service.ts
  • editor/src/app/rerender/template-rerender.service.spec.ts
  • editor/src/app/rerender/template-rerender.service.ts
  • editor/src/app/rerender/utilities/content.ts
  • engine/js/BertaEditor.js
  • engine/js/BertaPortfolio.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Preview load polling now waits for a body and stops polling if navigation replaces the document. Rerender services now call reloadBackendJs instead of the removed helper. Tests cover preview polling and selected template rerender cases.

Changes

Preview Load Polling

Layer / File(s) Summary
Document-bound preview polling
editor/src/app/preview/preview.component.ts, editor/src/app/preview/preview.component.spec.ts
waitFullLoad polls only the document present when the iframe load event fires. It waits if the body is absent or lacks the expected Berta classes. Tests cover ready states, missing bodies, timeout, and navigation.

Backend Reload After Rerender

Layer / File(s) Summary
Backend reload helper
editor/src/app/rerender/utilities/content.ts
The removeExtraAddBtnAndAddListeners helper is removed. The reloadBackendJs comment describes listener rebinding and create-new-entry link replacement.
Rerender call sites and tests
editor/src/app/rerender/common/page-layout.service.ts, editor/src/app/rerender/default-template-rerender.service.ts, editor/src/app/rerender/template-rerender.service.ts, editor/src/app/rerender/template-rerender.service.spec.ts
Rerender paths call reloadBackendJs after updating page content or entries. Tests cover entry creation and site-settings rerendering.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to d7303

The change makes preview polling and rerender notifications more robust. No concrete merge-blocking issue was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main changes, which fix preview loading and rerender errors. It is broad but clear and relevant.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The event fires after every entries rerender (entry changes, settings,
page layout), not only when an entry is added, and the function that
dispatched it didn't reload anything. Name both after what happens,
matching sitesMenuRerendered and sectionsMenuRerendered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@uldisrudzitis
uldisrudzitis merged commit 94e2b53 into master Oct 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant