unset no longer working since 1.10.12

Open
#987 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
frontend

Research direction

Start with the InteractableBase unset method shown in the issue and compare its 1.10.11 and 1.10.12 behavior. Reproduce the duplicate-interactable case in Chrome, then verify that unset removes the interactable from scope.interactables.list and does not leave duplicates.

Written by the indexing model from the issue text.

Description

If you have questions about the API that aren't answered in the docs or FAQ, try asking in the Gitter chatroom or on Stackoverflow.

If you've found something that looks like a bug, include a link to a minimal demo on JSFilddle, Codepen with instructions to reproduce the bug with and roughly follow the following issue description format:

Expected behavior

Tell us what should happen

I have been using 1.10.11 for a while and updated to the latest version and unset no longer removes my interactables from the list leading to duplicates. The issue happens from version 1.10.12 were unset was modified.

1.10.11

  unset (this: InteractableBase) {
    super.unset()
    scope.interactables.list.splice(scope.interactables.list.indexOf(this), 1)

    scope.fire('interactable:unset', { interactable: this })
  }

1.10.12

  unset (this: InteractableBase) {
    super.unset()

    const index = scope.interactables.list.indexOf(this)
    if (index < 0) return

    super.unset()
    scope.interactables.list.splice(index, 1)
    scope.fire('interactable:unset', { interactable: this })
  }
Actual behavior

Tell us what happens instead

when I run the code step by step in 1.10.12 the code jumps over the splice call. I have no idea why but it makes the code no longer work.

System configuration

interact.js version:
1.10.11 to 1.10.12
Browser name and version:
Chrome
Operating System:
Windows 10

Dominant language
TypeScript
Stars
12.9k
Forks
804
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from taye/interact.js

All issues in taye/interact.js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.