You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a message is destroyed with click (invoking public destroyMessage() of flash/object) the _destroyLater() try destroy again the object after timeout ... and throws a error. If the message clicked is on the middle of array ... the others messages (newer) are not erased by timeout.
One possible solution is cancel the try of _destroyLater() when _destroyMessage() is invoked (flash/object) :
_destroyLaterTimer: null,
_destroyLater: function() {
var defaultTimeout = get(this, 'defaultTimeout');
var timeout = getWithDefault(this, 'timeout', defaultTimeout);
this.set('_destroyLaterTimer', run.later(this, '_destroyMessage', timeout));
}.on('init'),
_destroyMessage: function() {
var queue = get(this, 'queue');
run.cancel(this.get('_destroyLaterTimer'));
set(this, 'isDestroyed', true);
if (queue) {
queue.removeObject(this);
}
}
Other solution is verify if the object is already destroyed when _destroyMessage() is invoked:
@felipehw I have to admit I completely forgot about cancelling, so thanks for catching this! Give 0.2.0 a whirl and let me know if you still get the same error.
@poteto is there a way by which one can close the current flash message? lets say my template has an anchor tag which will close/delete the flash message.
Ember.get(this, 'flashMessages').clearMessages();
will clear all messages, but in this use-case the messages stack one on top of the other based on priority. So this is how it is required:
{{#flash-message flash=flash as |component flash|}}
{{{flash.message}}}
<a href="#" ______> x </a> -- click this and the currently selected flash message should disappear.
{{/flash-message}}
Also, would like to know if there is a way to prevent the click on the flash message. Only click on the cross will close the flash message.
When a message is destroyed with click (invoking public
destroyMessage()
offlash/object
) the_destroyLater()
try destroy again the object after timeout ... and throws a error. If the message clicked is on the middle of array ... the others messages (newer) are not erased by timeout.One possible solution is cancel the try of
_destroyLater()
when_destroyMessage()
is invoked (flash/object
) :Other solution is verify if the object is already destroyed when
_destroyMessage()
is invoked:The text was updated successfully, but these errors were encountered: