-
Notifications
You must be signed in to change notification settings - Fork 27.4k
App freezes when using a directive that transcludes ng-message #14183
Comments
FWIW, this is not related to Without looking too much into it, there seems to be an infinite loop because the Ugly, temp, hackish work-around: PRepend a dummy |
So, since this broke in |
@gkalpak thanks, good to know there is a temporary workaround |
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that only messages with an index lower than the starting message are considered previous elements. Fixes angular#14183
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that only messages with an index lower than the starting message are considered previous elements. Fixes angular#14183
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that only messages with an index lower than the starting message are considered previous elements. Fixes angular#14183
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that only messages with an index lower than the starting message are considered previous elements. Fixes angular#14183
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that only messages with an index lower than the starting message are considered previous elements. Fixes angular#14183
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that when searching for previous messages, ngMessage walks the DOM in a way so that messages that come after the current message are never identified as previous messages. This commit also detaches and destroys all child ngMessage elements when the ngMessages element is destroyed, which should improve performance slightly. Fixes angular#14183 Closes angular#14242
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that when searching for previous messages, ngMessage walks the DOM in a way so that messages that come after the current message are never identified as previous messages. This commit also detaches and destroys all child ngMessage elements when the ngMessages element is destroyed, which should improve performance slightly. Fixes #14183 Closes #14242
Under specific circumstances, ngMessages would go into an infinite loop and crash the browser / page: - At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude) - The first message is currently visible - The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf) When a message is removed, it looks for a previous message - in this specific case it would misidentify the second message for a previous message, which would then cause the first message to be marked as the second message's next message, resulting in an infinite loop, and crash. This fix ensures that when searching for previous messages, ngMessage walks the DOM in a way so that messages that come after the current message are never identified as previous messages. This commit also detaches and destroys all child ngMessage elements when the ngMessages element is destroyed, which should improve performance slightly. Fixes #14183 Closes #14242
Tested in 1.5.3 and this is working now. Thanks! |
I tried with 1.5.3 and I still get a crash with ng-messages-include but not with ng-message. |
@mbeauchamp7 Without a runnable demo / code we cannot do anything about this. |
@mbeauchamp7 Please open a new issue with a minimal demo if you have on. Thanks! |
I'm trying to create a directive that contains some common css classes and hide/show logic that I use for all my
ng-messages
. it looks like thisIt is causing my app to freeze when the following is true:
-there is a validation error causing one of the
ng-message
s to be shown-there are multiple
ng-message
elements-The user navigates to another page
The following plunkr reproduces the issue: https://plnkr.co/edit/Qi2JQ4RioAOxZG98uCou?p=preview
To crash the app click the input and then click the "other page" link.
I'm using Angular 1.5, angular-messages 1.5, and ui-router 0.2.18. This issue exists in Chrome and Firefox but works fine in IE11 (although it freezes for a second)
The text was updated successfully, but these errors were encountered: