Skip to content

Disabled plugins should not bind events #1611

Closed

Description

@OkanEsen

Problem:

I'm using the UMD version of SortableJS which has all plugins already bundled. The multidrag plugin is disabled by default, but the events on document are still set, regardless if multiDrag is set to true or false.

Another idea would be to introduce a method inside PluginManager to unmount plugins.

Activity

  1. owen-m1 commented on Aug 23, 2019

    @owen-m1
    Member

    This is so that the plugin can be dynamically enabled even after initialisation. Is there a reason the events should not be set?

    If you are not using multiDrag at all I would recommend you use the tree-shakeable modular version

  2. OkanEsen commented on Aug 23, 2019

    @OkanEsen
    Author

    This is so that the plugin can be dynamically enabled even after initialisation. Is there a reason the events should not be set?

    I'm using it on a legacy project in combination with jQuery (https://github.com/SortableJS/jquery-sortablejs) and need to generate dynamic lists with a SortableJS instance attached to it. This is working but creating new instances of SortableJS also creates multiple events on the document node, since it's always reattaching it.

    If you are not using multiDrag at all I would recommend you use the tree-shakeable modular version

    Unfortunately not possible, since it's a legacy project.

  3. owen-m1 commented on Aug 23, 2019

    @owen-m1
    Member

    @OkanEsen I just realized that the multiDrag events may not be being removed from the document if a Sortable is destroyed but multiDrag isn't enabled.

    Also, you could create a separate folder and just build the modular versions yourself without MultiDrag and it should give you a UMD.

  4. OkanEsen commented on Aug 24, 2019

    @OkanEsen
    Author

    @OkanEsen I just realized that the multiDrag events may not be being removed from the document if a Sortable is destroyed but multiDrag isn't enabled.

    Yeah, exactly. I noticed that the page was becoming a huge resource hog after destroying and creating several instances of SortableJS which were events bound by the MultiDrag plugin (see attachment below).

    Details

    2019-08-24_15-13

    Also, you could create a separate folder and just build the modular versions yourself without MultiDrag and it should give you a UMD.

    I'm going to do this for now, thanks.

  5. added a commit that references this issue on Sep 2, 2019
  6. owen-m1 commented on Sep 2, 2019

    @owen-m1
    Member

    I solved the bug so I will close this

  7. added a commit that references this issue on Nov 18, 2019
  8. added a commit that references this issue on Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions