Skip to content

fix(plugin): plugin <script> tags accumulate in <head> when plugin is uninstalled#1878

Merged
UnschooledGamer merged 2 commits intoAcode-Foundation:mainfrom
UnschooledGamer:fix/plugin-script-on-uninstallation
Feb 18, 2026
Merged

fix(plugin): plugin <script> tags accumulate in <head> when plugin is uninstalled#1878
UnschooledGamer merged 2 commits intoAcode-Foundation:mainfrom
UnschooledGamer:fix/plugin-script-on-uninstallation

Conversation

@UnschooledGamer
Copy link
Member

No description provided.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 17, 2026

Greptile Summary

fixes memory leak where plugin <script> tags accumulated in <head> when plugins were uninstalled and reinstalled

  • added unique id attribute to plugin script tags in loadPlugin.js (format: ${pluginId}-mainScript)
  • implemented script tag removal in the uninstall function to clean up DOM when plugins are uninstalled
  • prevents <head> bloat from repeated plugin install/uninstall cycles

Confidence Score: 4/5

  • safe to merge after fixing missing semicolons
  • the fix correctly addresses the script tag accumulation issue with proper DOM cleanup, but has minor syntax issues (missing semicolons) that should be corrected
  • src/sidebarApps/extensions/index.js needs semicolons added to lines 871-872

Important Files Changed

Filename Overview
src/lib/loadPlugin.js added unique id attribute to plugin script tag for proper cleanup
src/sidebarApps/extensions/index.js implemented script tag removal on uninstall, missing semicolons on new lines
src/lib/acode.js formatting change (added space in empty function), no functional impact

Sequence Diagram

sequenceDiagram
    participant User
    participant Extensions as extensions/index.js
    participant LoadPlugin as loadPlugin.js
    participant DOM as document.head

    User->>Extensions: Install Plugin
    Extensions->>LoadPlugin: loadPlugin(pluginId)
    LoadPlugin->>LoadPlugin: Create script tag with id="${pluginId}-mainScript"
    LoadPlugin->>DOM: append(script)
    DOM-->>LoadPlugin: Script loaded
    LoadPlugin-->>Extensions: Plugin initialized

    Note over DOM: Script tag remains in head

    User->>Extensions: Uninstall Plugin
    Extensions->>DOM: getElementById("${pluginId}-mainScript")
    DOM-->>Extensions: Return script element
    Extensions->>DOM: removeChild(script)
    Note over DOM: Script tag removed (prevents accumulation)
Loading

Last reviewed commit: 41e3a2a

greptile-apps[bot]

This comment was marked as resolved.

@UnschooledGamer UnschooledGamer merged commit c2f6644 into Acode-Foundation:main Feb 18, 2026
6 checks passed
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

Comments