input_pill: Break import cycle with `compose_recipient.js`.

This commit breaks the trivial import cycle between `input_pill` and
`compose_recipient.js` by manually triggering an on-change event when we remove
a pill which makes sure to run the `update_on_recipient_change` as
the event callback without us having to import it inside `input_pill`
and manually calling it.

Fixes: #25022
This commit is contained in:
Lalit 2023-04-07 19:07:19 +05:30 committed by Tim Abbott
parent c0e9e463fb
commit 83e1d78b7b
1 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import $ from "jquery";
import render_input_pill from "../templates/input_pill.hbs";
import * as blueslip from "./blueslip";
import * as compose_recipient from "./compose_recipient";
import * as keydown_util from "./keydown_util";
import * as ui_util from "./ui_util";
@ -164,6 +163,11 @@ export function create(opts) {
store.removePillFunction(pill);
}
// This is needed to run the "change" event handler registered in
// compose_recipient.js, which calls the `update_on_recipient_change` to update
// the compose_fade state.
store.$input.trigger("change");
return pill;
}
@ -358,8 +362,6 @@ export function create(opts) {
funcs.removePill($pill[0]);
$next.trigger("focus");
compose_recipient.update_on_recipient_change();
});
store.$parent.on("click", function (e) {