# Closing a JSONata editor leaves out a IDLE thread

**URL:** <https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535>\
**Category:** Core Development\
**Created:** [1 June 2021 03:37 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535 "2021-06-01T03:37:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qin/32/12715_2.png) [@Qin](https://discourse.nodered.org/u/Qin)\
**Post date:** [1 June 2021 03:37 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/1 "2021-06-01T03:37:15Z")

</div>

@dceejay @knolleary

Dear Sir,  
As title said, a thread is left after closing a JSONata editor.

**Reproduce Steps:**

1. Open JSONata editor from debug node, we can found there are 3 threads and this is OK.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/d/ed409899a5324a7519dc19742e4dea29447999a2.png)

2.Click _Cancel_ button, the editor is closed successfully but there left a thread isn't deleted.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0d4dcee35a74d2f94921bd12768302cdee86a072.png)

**Reason:**  
By checking` @node-red/editor-client/src/js/ui/edtiors/expression.js`,  
line 340~line 345, `testResultEditor.destroy()` is missed.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1b5b15fd585b50bfde03a403af253afd7b8db414.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 June 2021 07:14 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/2 "2021-06-01T07:14:33Z")

</div>

Thanks for reporting. Feel free to raise a PR with a fix if you'd like.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 June 2021 07:23 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/3 "2021-06-01T07:23:15Z")

</div>

For awareness, this is already fixed in dev when monaco commit [missing editor destroy() calls #251dda3](https://github.com/node-red/node-red/pull/2971/commits/251dda36529f1f8e62458a0e8b025dcc9c08ef6c) was merged.

---

<div class="post-metadata">

**Author:** ![Qin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qin/32/12715_2.png) [@Qin](https://discourse.nodered.org/u/Qin)\
**Post date:** [1 June 2021 08:05 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/4 "2021-06-01T08:05:19Z")

</div>

Hi Nick, many thanks for your reply. As Steve said, since this PR is already raised, I will skip it.

---

<div class="post-metadata">

**Author:** ![Qin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qin/32/12715_2.png) [@Qin](https://discourse.nodered.org/u/Qin)\
**Post date:** [1 June 2021 08:05 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/5 "2021-06-01T08:05:56Z")

</div>

Hi Steve, I see. Many thanks for your reply.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 June 2021 08:17 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/6 "2021-06-01T08:17:33Z")

</div>

We should still fix it in the master branch for any future 1.x release

The Dev branch is for the 2.x release.

---

<div class="post-metadata">

**Author:** ![Qin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qin/32/12715_2.png) [@Qin](https://discourse.nodered.org/u/Qin)\
**Post date:** [1 June 2021 08:37 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/7 "2021-06-01T08:37:13Z")

</div>

I see. I will raise a PR for it. many thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 June 2021 08:37 UTC](https://discourse.nodered.org/t/closing-a-jsonata-editor-leaves-out-a-idle-thread/46535/8 "2021-06-15T08:37:45Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
