Summary
Three related code quality and bug findings that affect widget reliability and maintainability:
1. Engagement Zone Rotation Intervals Can Stack (Bug)
File: src/modal/modal.ts, lines 173-179, 224-227
startEngagementZoneRotation() calls setInterval without first clearing any existing interval. handleImageLoad() (line 224) calls startEngagementZoneRotation() without calling stopEngagementZoneRotation() first. If preloadEngagementZoneImages() is called multiple times (via updateModalOptions, line 140), multiple intervals stack, causing increasingly rapid rotation.
Fix: Call stopEngagementZoneRotation() at the beginning of startEngagementZoneRotation().
2. Body Click Handler May Inadvertently Recreate Modal
File: src/modal/modal-manager.ts, lines 93-98
handleRootClick calls this.getModal() which creates a new modal element if one does not exist. Clicking anywhere on the body after modal removal could inadvertently recreate it.
Fix: Use this.modalElement directly with a null check instead of this.getModal():
private handleRootClick = (event: MouseEvent) => {
if (this.modalElement && !this.modalElement.contains(event.target as Node)) {
this.removeModal();
}
};
3. Rollup v2 is Outdated and No Longer Receiving Security Patches
File: package.json, line 62
"rollup": "^2.73.0" — Rollup v2 has been superseded by v4 (stable since late 2023). V2 no longer receives security patches. Several plugins are also at outdated major versions.
Fix: Upgrade to Rollup v4 along with compatible plugin versions (@rollup/plugin-node-resolve, @rollup/plugin-terser, etc.).
Expected Impact
- Prevents engagement zone carousel from accelerating unexpectedly
- Eliminates accidental modal recreation on stray body clicks
- Gains better tree-shaking, faster builds, and security patches via Rollup v4
References
Generated by Heart Beat with Omni
Summary
Three related code quality and bug findings that affect widget reliability and maintainability:
1. Engagement Zone Rotation Intervals Can Stack (Bug)
File:
src/modal/modal.ts, lines 173-179, 224-227startEngagementZoneRotation()callssetIntervalwithout first clearing any existing interval.handleImageLoad()(line 224) callsstartEngagementZoneRotation()without callingstopEngagementZoneRotation()first. IfpreloadEngagementZoneImages()is called multiple times (viaupdateModalOptions, line 140), multiple intervals stack, causing increasingly rapid rotation.Fix: Call
stopEngagementZoneRotation()at the beginning ofstartEngagementZoneRotation().2. Body Click Handler May Inadvertently Recreate Modal
File:
src/modal/modal-manager.ts, lines 93-98handleRootClickcallsthis.getModal()which creates a new modal element if one does not exist. Clicking anywhere on the body after modal removal could inadvertently recreate it.Fix: Use
this.modalElementdirectly with a null check instead ofthis.getModal():3. Rollup v2 is Outdated and No Longer Receiving Security Patches
File:
package.json, line 62"rollup": "^2.73.0"— Rollup v2 has been superseded by v4 (stable since late 2023). V2 no longer receives security patches. Several plugins are also at outdated major versions.Fix: Upgrade to Rollup v4 along with compatible plugin versions (
@rollup/plugin-node-resolve,@rollup/plugin-terser, etc.).Expected Impact
References
Generated by Heart Beat with Omni