Skip to content

fix: reset embed iframe queue consistently to preserve UI commands#27419

Merged
hariombalhara merged 3 commits intomainfrom
fix-embed-queue-issue-another-place
Feb 2, 2026
Merged

fix: reset embed iframe queue consistently to preserve UI commands#27419
hariombalhara merged 3 commits intomainfrom
fix-embed-queue-issue-another-place

Conversation

@hariombalhara
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara commented Jan 30, 2026

What does this PR do?

Fixes inconsistent queue reset behavior in the embed iframe. Previously, after processing queued actions, the queue was completely cleared (this.iframeDoQueue = []), while iframeReset() preserved UI-related commands. This PR extracts the queue filtering logic into a reusable resetQueue() method and uses it in both places to ensure consistent behavior.

The problem: When queued actions were processed, all commands including UI configuration commands were cleared. This meant UI settings wouldn't persist correctly across certain scenarios.

The fix: Extract the queue filtering logic into resetQueue() and call it both in iframeReset() and after processing queued actions, ensuring only commands in commandsPersistAcrossIframeResets are preserved.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - internal implementation change only.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Create an embed with UI configuration commands (e.g., Cal("ui", {...}))
  2. Trigger actions that cause the queue to be processed
  3. Verify that UI configuration persists after queue processing
  4. Verify that non-UI commands are properly cleared

Human Review Checklist

  • Verify that preserving UI commands after processing queued actions (not just during iframe reset) is the intended behavior change
  • Confirm commandsPersistAcrossIframeResets contains the correct set of commands that should persist

Summary by cubic

Make embed iframe queue reset consistent so only UI-related commands persist after reloads. This prevents stale actions and keeps UI config in sync across iframe resets.

  • Bug Fixes
    • Added resetQueue() and used it in iframeReset and after processing queued actions, filtering the queue to only keep commands that should persist across resets.

Written for commit 9a13594. Summary will update on new commits.


Open with Devin

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 30, 2026

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Reset queue correctly all places". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@devin-ai-integration devin-ai-integration bot changed the title Reset queue correctly all places fix: reset embed iframe queue consistently to preserve UI commands Jan 30, 2026
@hariombalhara hariombalhara marked this pull request as ready for review January 30, 2026 03:42
@hariombalhara hariombalhara requested a review from a team as a code owner January 30, 2026 03:42
@graphite-app graphite-app bot added the enterprise area: enterprise, audit log, organisation, SAML, SSO label Jan 30, 2026
@graphite-app graphite-app bot requested a review from a team January 30, 2026 03:42
@graphite-app graphite-app bot added the core area: core, team members only label Jan 30, 2026
@hariombalhara hariombalhara self-assigned this Jan 30, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

* test: verify UI config persists on second modal open

Co-Authored-By: [email protected] <[email protected]>

* fix: update iframe selection logic in getEmbedIframe function

Refactor the getEmbedIframe function to improve iframe selection by using a more specific selector and ensuring the last iframe is targeted in cases of repeated modal openings. This change enhances reliability in iframe handling during tests.

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

E2E results are ready!

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/embeds/embed-core/playwright/lib/testUtils.ts">

<violation number="1" location="packages/embeds/embed-core/playwright/lib/testUtils.ts:90">
P2: `elementHandle()` does not wait for the iframe to exist; removing `waitFor()` can return null and exit early before the target iframe is attached. Re-introduce a wait for the locator to avoid flaky null returns when another embed has already set `iframeReady`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const iframeSelector = `iframe[name="cal-embed=${calNamespace}"]`;
// In case of modal we don't cleanup previous iframe on repeat click, so we should read the last one by default as that would be the one actie
const targetIframeElement = page.locator(iframeSelector).last();
let elementHandle = await targetIframeElement.elementHandle();
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 30, 2026

Choose a reason for hiding this comment

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

P2: elementHandle() does not wait for the iframe to exist; removing waitFor() can return null and exit early before the target iframe is attached. Re-introduce a wait for the locator to avoid flaky null returns when another embed has already set iframeReady.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/embeds/embed-core/playwright/lib/testUtils.ts, line 90:

<comment>`elementHandle()` does not wait for the iframe to exist; removing `waitFor()` can return null and exit early before the target iframe is attached. Re-introduce a wait for the locator to avoid flaky null returns when another embed has already set `iframeReady`.</comment>

<file context>
@@ -87,14 +87,19 @@ export const getEmbedIframe = async ({
-  await targetIframeElement.waitFor();
-  const elementHandle = await targetIframeElement.elementHandle();
-  const embedIframe = await elementHandle?.contentFrame();
+  let elementHandle = await targetIframeElement.elementHandle();
+  let embedIframe = await elementHandle?.contentFrame();
 
</file context>
Fix with Cubic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed the Cubic AI feedback regarding the elementHandle() call at line 90 in packages/embeds/embed-core/playwright/lib/testUtils.ts.

The confidence score for this issue is 6/10, which is below the 9/10 threshold required for automated fixes. The issue suggests re-introducing a waitFor() call before elementHandle() to avoid potential null returns.

Since the confidence is below the threshold, I'm not making changes automatically. The PR author or reviewers should evaluate whether this is a valid concern that needs to be addressed manually.

@github-actions
Copy link
Copy Markdown
Contributor

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

@hariombalhara hariombalhara enabled auto-merge (squash) January 30, 2026 13:18
Copy link
Copy Markdown
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Looks good to me, sensible change.

@hariombalhara hariombalhara merged commit bc39258 into main Feb 2, 2026
57 checks passed
@hariombalhara hariombalhara deleted the fix-embed-queue-issue-another-place branch February 2, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants