From 35a49fa4974bdefd35675c4128d857f7580ebc0b Mon Sep 17 00:00:00 2001
From: Bob Zeleznik <zzzman@gmail.com>
Date: Tue, 2 Jun 2020 19:09:42 -0400
Subject: fixed updating of parameters box

---
 src/client/views/nodes/ScriptingBox.tsx | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

(limited to 'src/client/views/nodes/ScriptingBox.tsx')

diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx
index 18a9df9b4..f1105e614 100644
--- a/src/client/views/nodes/ScriptingBox.tsx
+++ b/src/client/views/nodes/ScriptingBox.tsx
@@ -1,4 +1,4 @@
-import { action, computed, observable, trace } from "mobx";
+import { action, computed, observable, trace, runInAction } from "mobx";
 import { observer } from "mobx-react";
 import * as React from "react";
 import { Doc } from "../../../fields/Doc";
@@ -476,16 +476,17 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
             console.log("hello");
             const getCaretCoordinates = require('textarea-caret');
 
-            let top = 0;
-            let left = 0;
+            const This = this;
             document.querySelector('textarea')?.addEventListener('input', function () {
                 const caret = getCaretCoordinates(this, this.selectionEnd);
                 console.log('(top, left, height) = (%s, %s, %s)', caret.top, caret.left, caret.height);
-                top = caret.top;
-                left = caret.left;
+                let top = caret.top;
+                let left = caret.left;
+                runInAction(() => {
+                    This._suggestionBoxX = left;
+                    This._suggestionBoxY = top;
+                });
             });
-            this._suggestionBoxX = left;
-            this._suggestionBoxY = top;
 
             this._scriptSuggestedParams = this.getSuggestedParams(pos);
 
-- 
cgit v1.2.3-70-g09d2

