# Data join() calls enter instead of update

**URL:** <https://talk.observablehq.com/t/data-join-calls-enter-instead-of-update/4109>\
**Category:** Help\
**Created:** [November 6, 2020, 4:51am UTC](https://talk.observablehq.com/t/data-join-calls-enter-instead-of-update/4109 "2020-11-06T04:51:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nvelden](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/nvelden/32/3827_2.png) [@nvelden](https://talk.observablehq.com/u/nvelden)\
**Post date:** [November 6, 2020, 4:51am UTC](https://talk.observablehq.com/t/data-join-calls-enter-instead-of-update/4109/1 "2020-11-06T04:51:54Z")

</div>

I would like to update my data output based on a select input. Whenever I change the input the new values are entered but the update and exit joins are not triggered.

See notebook:

> **[Table Merge](https://observablehq.com/@nvelden/table-merge)**
>
> Table Merge

Could anybody see what I am doing wrong? I have asked the same Question on Stackoverflow and there I got the response that the code worked fine outside of ObservableHQ.

---

<div class="post-metadata">

**Author:** ![yurivish](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/yurivish/32/198_2.png) [@yurivish](https://talk.observablehq.com/u/yurivish)\
**Post date:** [November 6, 2020, 5:50am UTC](https://talk.observablehq.com/t/data-join-calls-enter-instead-of-update/4109/2 "2020-11-06T05:50:21Z")

</div>

There’s a longer explanation to be made, but the short answer is that it is indeed due to Observable’s evaluation model — the cell containing your update code is re-run when the select box changes, and since that cell also happens to create a brand new `div`, you wind up creating all the elements anew each time.

A minimal change is to move the `div` variable to its own cell:

> **[Table Merge](https://observablehq.com/d/e42c519b568d26a2)**
>
> Table Merge

Now the update code runs reactively in response to the select box, and the data-join joins to the existing contents of `div`.

---

<div class="post-metadata">

**Author:** ![nvelden](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/nvelden/32/3827_2.png) [@nvelden](https://talk.observablehq.com/u/nvelden)\
**Post date:** [November 6, 2020, 6:12am UTC](https://talk.observablehq.com/t/data-join-calls-enter-instead-of-update/4109/3 "2020-11-06T06:12:34Z")

</div>

Thank you so much!

I am trying to run the code in R shiny using the R2d3 package. There I have the same issue that all code re-runs whenever the data changes. Is there a general concept or D3 way of isolating code from re-running on input change?
