Skip to content

feat: live preview: added outside iframe code#468

Merged
contentstackMridul merged 1 commit intolive-preview-outside-iframefrom
VE_6811
Jul 23, 2025
Merged

feat: live preview: added outside iframe code#468
contentstackMridul merged 1 commit intolive-preview-outside-iframefrom
VE_6811

Conversation

@contentstackMridul
Copy link
Copy Markdown
Contributor

This pull request introduces a new ON_RELOAD event to the live preview system, enabling enhanced functionality for handling reload scenarios. The changes span multiple files, adding support for the new event and ensuring proper integration into the live preview event manager and hooks.

Addition of ON_RELOAD event:

  • Constant definition: Added ON_RELOAD to the LIVE_PREVIEW_POST_MESSAGE_EVENTS object in src/livePreview/eventManager/livePreviewEventManager.constant.ts.
  • Event handling: Updated the EventManager initialization in src/livePreview/eventManager/livePreviewEventManager.ts to dynamically set the target based on the presence of window.opener.

Integration into hooks:

  • New hook: Created useOnReloadPostMessageEvent in src/livePreview/eventManager/postMessageEvent.hooks.ts to listen for the ON_RELOAD event and reload the page with updated parameters.
  • Hook usage: Integrated useOnReloadPostMessageEvent into the initialization flow in sendInitializeLivePreviewPostMessageEvent.

Type definition:

  • Event data type: Added OnReloadLivePreviewPostMessageEventData interface in src/livePreview/eventManager/types/livePreviewPostMessageEvent.type.ts to define the structure of the ON_RELOAD event payload.

@contentstackMridul contentstackMridul requested a review from a team as a code owner July 23, 2025 05:46
@github-actions
Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 72.36% 8623 / 11916
🔵 Statements 72.36% 8623 / 11916
🔵 Functions 71.89% 307 / 427
🔵 Branches 84.74% 1072 / 1265
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/livePreview/eventManager/livePreviewEventManager.constant.ts 100% 100% 100% 100%
src/livePreview/eventManager/livePreviewEventManager.ts 86.66% 0% 100% 86.66% 14-15
src/livePreview/eventManager/postMessageEvent.hooks.ts 79.24% 76.47% 80% 79.24% 35-37, 65-71, 98-99, 112, 121, 135-143
src/livePreview/eventManager/types/livePreviewPostMessageEvent.type.ts 0% 0% 0% 0%
Generated in workflow #479 for commit dda0f4d by the Vitest Coverage Report Action

Copy link
Copy Markdown

@KANE-99 KANE-99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@contentstackMridul contentstackMridul merged commit ecfc580 into live-preview-outside-iframe Jul 23, 2025
10 checks passed
@contentstackMridul contentstackMridul deleted the VE_6811 branch July 23, 2025 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants