# Unresponsive bug when working with interactions and components are used

**URL:** https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518
**Category:** UXP Plugin API
**Created:** [February 10, 2021, 11:57am UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518 "2021-02-10T11:57:29Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![sebbe](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/sebbe/32/1080_2.png) [@sebbe](https://forums.creativeclouddeveloper.com/u/sebbe)
#### Post date: [February 10, 2021, 11:57am UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/1 "2021-02-10T11:57:30Z")

</div>

Hi,

I have a piece of code in my plugin that extracts all interactions from a document.  
I am using ‘interactions.allInteractions’ to get a list of interactions I can iterate over.

It is working as expected, until I add a component to my an artboard and add an interaction to it. A basic simple interaction like tap and gotoartboard is enough to make it break.

Simplest case is to spin up simple plugin template, and add console.log(interactions.allInteractions). That will make the plugin unresponsive, if a component with an interaction is added.

Specifically; I loop this array, but as soon as a I access an item eg. interactions.allInteractions[0] and that item is an interaction on a component, the code just freezes. Accessing other elements that is not an interaction on a component works with no freezing.

EDIT: It appears that this is also a problem when accessing Artboard.incomingInteractions and a component links to that artboard. Also if the component is in the library only and not in the document.

Hope for a quick solution.

---

<div class="post-metadata">

### Author: ![kerrishotts](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/kerrishotts/32/8_2.png) [@kerrishotts](https://forums.creativeclouddeveloper.com/u/kerrishotts)
#### Post date: [February 10, 2021, 4:01pm UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/2 "2021-02-10T16:01:39Z")

</div>

@DavidXD ^^^ Any ideas here?

---

<div class="post-metadata">

### Author: ![DavidXD](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/davidxd/32/909_2.png) [@DavidXD](https://forums.creativeclouddeveloper.com/u/DavidXD)
#### Post date: [February 10, 2021, 9:30pm UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/3 "2021-02-10T21:30:16Z")

</div>

Hi, Sebbe. I spent some time looking at this with my interactions test plugin, and was unable to reproduce this problem with components. I tried on both Mac and Windows. If you could please provide some more information, I will investigate further.

- Specific version of XD
- Mac or Windows?
- Example XD document that causes the bug (you can upload here)
- Snippet of the plugin code that fails

---

<div class="post-metadata">

### Author: ![sebbe](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/sebbe/32/1080_2.png) [@sebbe](https://forums.creativeclouddeveloper.com/u/sebbe)
#### Post date: [February 12, 2021, 4:03pm UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/4 "2021-02-12T16:03:24Z")

</div>

Hi @DavidXD

I have investigated a bit further, and found that it was not a problem with interactions.allInteractions after all. Sorry about that.

But I still got a problem related to it.  
I’m on Windows 10 with XD version 36.2.32.5

For each interaction I am trying to locate what artboard the triggerNode is in (Please advice if there is a better way). I do that with a small recursive function to find the parent Artboard. If I do this on nodes in the pasteboard or Components in the Library the parent property is breaking my code.

```
function getParentArtboard(node) {
	
  if (node instanceof Artboard) return node;

  return getParentArtboard(node.parent);
}

function runCommand() {

    const indexedInteractions = interactions.allInteractions;

    for (let i = 0; i < indexedInteractions.length; i++) {
        const node = indexedInteractions[i].triggerNode;
        const artboard = getParentArtboard(node);
        console.log(indexedInteractions[i].triggerNode.name, "is in", artboard ? artboard.name : "no artboard");
    }
}

```

I have created a small sample XD document along with my test plugin source:

[xd-example-bug.zip](https://forums.creativeclouddeveloper.com/uploads/short-url/3crEstHMUjb9XcY8QA9GN8Pefqf.zip) (15.2 KB)

Thank you!

---

<div class="post-metadata">

### Author: ![sebbe](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/sebbe/32/1080_2.png) [@sebbe](https://forums.creativeclouddeveloper.com/u/sebbe)
#### Post date: [February 16, 2021, 8:17am UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/5 "2021-02-16T08:17:54Z")

</div>

To elaborate, I’m also seeing this error message:

> Plugin TypeError: Cannot read property ‘8d407748::develop’ of undefined  
> at $Root.Group.pluginWrapper (lib/scenegraph/GroupExtension.js:1:25201)  
> at SymbolInstance.get (plugins/ScenegraphWrappers.js:1:13561)  
> at getParentArtboard (\develop\8d407748\main.js:24:12)  
> at e.exports.triggerBugFunction (\develop\8d407748\main.js:11:24)  
> at Object.\_dispatchCommandIdEvent (uxp://uxp-internal/pluginmanager\_scripts.js:1:41491)  
> at Object.invokeCommand (uxp://uxp-internal/pluginmanager\_scripts.js:1:40854)  
> at N.invokeCommand (uxp://uxp-internal/pluginmanager\_scripts.js:1:19468)  
> at plugins/PluginLoader.js:1:5941  
> at Object.execScenegraphEdit (plugins/ScenegraphGuard.js:1:5317)  
> at BaseCommand.\_invokePluginCommand [as \_commandFn] (plugins/PluginLoader.js:1:5892)  
> at BaseCommand.execute (lib/BaseCommand.js:1:929)  
> at Object.D [as executePluginCommand] (uxpDocumentUI/js/10.js:18:17410)  
> at e.exports.\_uiEntry.panelId.\_uiEntry.commandId.n.onclick (uxpDocumentUI/js/10.js:18:31844)  
> at e.exports.p (uxp://uxp-internal/domjs\_scripts.js:2:24351)  
> at uxp://uxp-internal/domjs\_scripts.js:2:8303  
> at Object.runWithNativeHandler ()  
> at I (uxp://uxp-internal/domjs\_scripts.js:2:8195)  
> at uxp://uxp-internal/domjs\_scripts.js:2:7803  
> at O (uxp://uxp-internal/domjs\_scripts.js:2:7814)  
> at k (uxp://uxp-internal/domjs\_scripts.js:2:8472)  
> at e (uxp://uxp-internal/domjs\_scripts.js:2:8970)  
> at e.exports.onEvent (uxp://uxp-internal/domjs\_scripts.js:2:186448)

Line 24 in main.js is where I access node.parent of the component in the library  
`24: return getParentArtboard(node.parent);`

Also updated to latest version of XD: 37.0.32.10

---

<div class="post-metadata">

### Author: ![DavidXD](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/davidxd/32/909_2.png) [@DavidXD](https://forums.creativeclouddeveloper.com/u/DavidXD)
#### Post date: [February 18, 2021, 2:19am UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/6 "2021-02-18T02:19:25Z")

</div>

Sebbe, thank you for the code and detailed information. I was able to reproduce the error you saw when trying to get the parent of an interaction trigger node when that node is a component. I logged a bug with our team.

---

<div class="post-metadata">

### Author: ![sebbe](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/sebbe/32/1080_2.png) [@sebbe](https://forums.creativeclouddeveloper.com/u/sebbe)
#### Post date: [February 18, 2021, 3:01pm UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/7 "2021-02-18T15:01:08Z")

</div>

Thank you @DavidXD  
Hoping for a quick fix.

Is there anythink I can do to detect if the triggerNode is in a component or not? The bug is breaking my plugin at the moment.

Thank you!

---

<div class="post-metadata">

### Author: ![DavidXD](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/davidxd/32/909_2.png) [@DavidXD](https://forums.creativeclouddeveloper.com/u/DavidXD)
#### Post date: [February 18, 2021, 6:44pm UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/8 "2021-02-18T18:44:02Z")

</div>

Here is some code to determine if a node is a Component:

`if (node.constructor.name === "SymbolInstance") { ...`

---

<div class="post-metadata">

### Author: ![sebbe](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/sebbe/32/1080_2.png) [@sebbe](https://forums.creativeclouddeveloper.com/u/sebbe)
#### Post date: [February 18, 2021, 10:59pm UTC](https://forums.creativeclouddeveloper.com/t/unresponsive-bug-when-working-with-interactions-and-components-are-used/2518/9 "2021-02-18T22:59:34Z")

</div>

I can confirm that adding this check works.

I have just submitted my plugin with the fix. Thank you!
