diff --git a/web/src/input_pill.js b/web/src/input_pill.js index 560db7f5e5..c6da225e2c 100644 --- a/web/src/input_pill.js +++ b/web/src/input_pill.js @@ -89,12 +89,6 @@ export function create(opts) { return; } - const payload = { - item, - }; - - store.pills.push(payload); - const has_image = item.img_src !== undefined; const opts = { @@ -120,7 +114,12 @@ export function create(opts) { } const pill_html = render_input_pill(opts); - payload.$element = $(pill_html); + const payload = { + item, + $element: $(pill_html), + }; + + store.pills.push(payload); store.$input.before(payload.$element); },