Skip to content

fix: cancel pending style manager updates on destroy - #6829

Open
sridharkalaibala wants to merge 1 commit into
GrapesJS:devfrom
sridharkalaibala:fix/style-manager-dispose-timers
Open

sridharkalaibala wants to merge 1 commit into
GrapesJS:devfrom
sridharkalaibala:fix/style-manager-dispose-timers

Conversation

@sridharkalaibala

Copy link
Copy Markdown

Style Manager cancels its debounced selection refresh during destruction, but leaves two other callbacks queued: property updates and custom events. A style change followed immediately by editor destruction still invokes the property updater; a target change followed by module destruction still emits a custom event.

Retain both debounced functions and cancel them alongside upAll after stopping listeners. This keeps deferred work from running after teardown without changing live update behavior.

Related to #6494. I investigated the rapid create/destroy report but could not reproduce its original exception on the current build; this PR addresses the confirmed incomplete cleanup and intentionally does not close that issue.

Validation:

  • Two regression cases fail on the original source and pass with the fix: pending property updates after editor destruction (with an actual styled selection) and custom events after module destruction. A live-update control passes in both versions.
  • Full core suite: 1,530 tests and 17 snapshots pass; 47 existing tests skipped. The strengthened selection setup was also rerun in the focused suite.
  • Core production build (JS, ESM, CSS and declarations), declaration type check, changed-file ESLint/Prettier, and diff checks pass.
  • Chromium running the built editor completes ten create/select/style/destroy cycles without page errors. Instrumented methods forward to the originals and confirm no property/custom callbacks execute after destruction.

Prepared with AI assistance and validated locally using Node 24.19.0 and pnpm 9.10.0. No dependency, lockfile, or public API changes.

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.

1 participant