app/components/coco/app/elements/alert/alert.js in coveragebook_components-0.8.0.beta.1 vs app/components/coco/app/elements/alert/alert.js in coveragebook_components-0.8.0.beta.2

- old
+ new

@@ -5,10 +5,17 @@ alert: null, dismissed: false, forceMultiLine: false, dismissDuration: 300, + init() { + this.checkSingleLineWrap = Alpine.throttle( + this.checkSingleLineWrap.bind(this), + 200 + ); + }, + dismiss() { if (this.$options.dismissable) { this.$dispatch("alert:dismiss", { alert: this, duration: this.dismissDuration, @@ -25,12 +32,14 @@ this.$root.remove(); }, checkSingleLineWrap({ height }) { this.forceMultiLine = false; - this.$nextTick(() => { - this.forceMultiLine = height > 24 && this.$options.singleLine; - }); + if (height > 24 && this.$options.singleLine) { + this.$nextTick(() => { + this.forceMultiLine = true; + }); + } }, root: { "x-options": '["dismissable", "singleLine"]', ":class": "{'force-multi-line': forceMultiLine}",