Skip to content

[WIP] Fix NotFoundError when duplicating slider block#2834

Merged
Soare-Robert-Daniel merged 7 commits into
developmentfrom
codex/fix-slider-block-duplication-error
Jun 16, 2026
Merged

[WIP] Fix NotFoundError when duplicating slider block#2834
Soare-Robert-Daniel merged 7 commits into
developmentfrom
codex/fix-slider-block-duplication-error

Conversation

@Codex

@Codex Codex AI commented Jun 2, 2026

Copy link
Copy Markdown

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>Slider block throws NotFoundError when duplicated</issue_title>
<issue_description>Duplicating a Slider block in the Gutenberg editor throws the following console error:

NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
    at Object.remove (glide.min.js:6:15857)
    at commitPassiveUnmountInsideDeletedTreeOnFiber (react-dom.js:25147)

Steps to reproduce:

  1. Add a Slider block with images in the editor
  2. Duplicate the block (Options menu → Duplicate, or Ctrl+Shift+D)
  3. Observe the error in the browser console

What's happening:

When the block is duplicated, React re-mounts the original block's component. During unmount, the useEffect cleanup in src/blocks/blocks/slider/edit.js calls sliderRef.current.destroy() on the Glide instance — but React has already detached the DOM nodes Glide holds references to, causing the removeChild failure.

Expected: Duplication completes without errors.

Affected file: src/blocks/blocks/slider/edit.js — useEffect cleanup (~line 108)</issue_description>

Comments on the Issue (you are @codex[agent] in this section)

Co-authored-by: Soare-Robert-Daniel <17597852+Soare-Robert-Daniel@users.noreply.github.com>
@Soare-Robert-Daniel

Copy link
Copy Markdown
Contributor

@codex[agent] also add an E2E tests by levreging the wp-env stat is already running

Co-authored-by: Soare-Robert-Daniel <17597852+Soare-Robert-Daniel@users.noreply.github.com>
@Codex

Codex AI commented Jun 2, 2026

Copy link
Copy Markdown
Author

@codex[agent] also add an E2E tests by levreging the wp-env stat is already running

Added Playwright E2E coverage for duplicating the Slider block (asserts no NotFoundError/removeChild console errors) and ensured global-setup.ts creates the storage-state directory so the existing wp-env instance can be reused reliably. Commit: 70467a7.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • app.formbricks.com
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl 8cd108dba2df5d43/bin/bash does not throw NotFoundError&#39; a4def502d75dc736cd /home/REDACTED/work/otter-blocks/otter-blocks &amp;&amp; npm run test:e2e:playwright:parallel -- src/blocks/test/e2e/blocks/slider.spec.js -g &#34;duplicate does not throw NotFoundError&#34; iginal (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl io.containerd.rugrep 9b8928e245f71ef4-qE (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl ef4d33cb9ab4fb65135a4def502d75dc736/aa6b96c10307265cfbf355a8720fb8205c049ed25c969603c84cba0672dd/var/run/docker/runtime-runc/moby 5d19b8928e245f71/home/REDACTED/work/otter-blocks/otter-blocks/node_modules/.bin/playwright (dns block)
  • s.w.org
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl 8cd108dba2df5d43/bin/bash does not throw NotFoundError&#39; a4def502d75dc736cd /home/REDACTED/work/otter-blocks/otter-blocks &amp;&amp; npm run test:e2e:playwright:parallel -- src/blocks/test/e2e/blocks/slider.spec.js -g &#34;duplicate does not throw NotFoundError&#34; iginal (dns block)
  • secure.gravatar.com
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl 8cd108dba2df5d43/bin/bash does not throw NotFoundError&#39; a4def502d75dc736cd /home/REDACTED/work/otter-blocks/otter-blocks &amp;&amp; npm run test:e2e:playwright:parallel -- src/blocks/test/e2e/blocks/slider.spec.js -g &#34;duplicate does not throw NotFoundError&#34; iginal (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl io.containerd.rugrep 9b8928e245f71ef4-qE (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl ef4d33cb9ab4fb65135a4def502d75dc736/aa6b96c10307265cfbf355a8720fb8205c049ed25c969603c84cba0672dd/var/run/docker/runtime-runc/moby 5d19b8928e245f71/home/REDACTED/work/otter-blocks/otter-blocks/node_modules/.bin/playwright (dns block)
  • wordpress.org
    • Triggering command: /opt/hostedtoolcache/node/22.22.3/x64/bin/node node /home/REDACTED/work/otter-blocks/otter-blocks/node_modules/.bin/wp-env status (dns block)
    • Triggering command: /opt/hostedtoolcache/node/22.22.3/x64/bin/node node /home/REDACTED/work/otter-blocks/otter-blocks/node_modules/.bin/wp-env logs --log=php --tail=200 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Soare-Robert-Daniel Soare-Robert-Daniel marked this pull request as ready for review June 2, 2026 12:36
@pirate-bot

pirate-bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 178.27 KB 178.27 KB 0 B (0.00%)
Blocks 1.5 MB 1.5 MB 52 B (0.00%)
CSS 7.87 KB 7.87 KB 0 B (0.00%)
Dashboard 108.48 KB 108.48 KB 0 B (0.00%)
Onboarding 68.14 KB 68.14 KB 0 B (0.00%)
Export Import 4.7 KB 4.7 KB 0 B (0.00%)
Pro 322.05 KB 322.05 KB 0 B (0.00%)

@pirate-bot

pirate-bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Plugin build for a021380 is ready 🛎️!

@pirate-bot

pirate-bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

E2E Tests

Playwright Test Status: See serial and parallel matrix jobs

Performance Results serverResponse: {"q25":391,"q50":398.3,"q75":427,"cnt":10}, firstPaint: {"q25":493,"q50":533.9,"q75":646.8,"cnt":10}, domContentLoaded: {"q25":3259.4,"q50":3275.75,"q75":3323.4,"cnt":10}, loaded: {"q25":3261.5,"q50":3277.7,"q75":3325.6,"cnt":10}, firstContentfulPaint: {"q25":3767.3,"q50":3781.8,"q75":3852.1,"cnt":10}, firstBlock: {"q25":13417.7,"q50":13434.5,"q75":13547.9,"cnt":10}, type: {"q25":22.63,"q50":23.49,"q75":24.44,"cnt":10}, typeWithoutInspector: {"q25":20.06,"q50":20.68,"q75":32.37,"cnt":10}, typeWithTopToolbar: {"q25":29.14,"q50":29.89,"q75":36.41,"cnt":10}, typeContainer: {"q25":13.14,"q50":13.84,"q75":16.43,"cnt":10}, focus: {"q25":111.33,"q50":113.78,"q75":115.23,"cnt":10}, inserterOpen: {"q25":37.33,"q50":37.97,"q75":38.96,"cnt":10}, inserterSearch: {"q25":13.07,"q50":13.38,"q75":13.79,"cnt":10}, inserterHover: {"q25":4.87,"q50":4.99,"q75":5.35,"cnt":20}, loadPatterns: {"q25":1470.82,"q50":1526.03,"q75":1652.1,"cnt":10}, listViewOpen: {"q25":211.03,"q50":215.12,"q75":218.46,"cnt":10}

@Soare-Robert-Daniel

Copy link
Copy Markdown
Contributor

@codex[agent] rebase the current branch and check the e2e from wp-env

Soare-Robert-Daniel and others added 4 commits June 16, 2026 13:04
Control+Shift+D does not duplicate the slider in the WP 7.0 editor (the
block opts out of the iframed canvas and captures key events), so the
regression test stalled at one block and never exercised the duplicate
-> unmount path it guards. Use the block toolbar Duplicate item instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With block API v3 the editor canvas is iframed and Otter blocks render
inside it, so query in-canvas elements through `editor.canvas`:

- slider: the "duplicate does not throw NotFoundError" test queried the
  block via `page`; switch its document lookups to `editor.canvas` and
  drop the stale "opts out of the iframed canvas" comment.

Also make the Form block suite resilient to cross-run option pollution:
the form block appends to `themeisle_blocks_form_emails`, which over many
runs accumulates entries that eventually fail REST schema validation and
read back as null. Whitelist the form options in the e2e bootstrap and
reset them to empty before each test via the otterUtils fixture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Soare-Robert-Daniel Soare-Robert-Daniel merged commit 3909bdb into development Jun 16, 2026
15 of 17 checks passed
@Soare-Robert-Daniel Soare-Robert-Daniel deleted the codex/fix-slider-block-duplication-error branch June 16, 2026 11:43
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.

3 participants