Dynamically adding a polymer element that contains polymer signals eliminates the exception

At Polymer, I implemented a custom form that uses polymer_signals.htmlto listen for changes from any other polymer elements.

It is implemented as follows:

<link rel="import" href="packages/polymer_elements/polymer_signals/polymer_signals.html">

<polymer-element name="user-settings" extends="form">
<template>
<polymer-signals on-polymer-signalauth-changed="{{onAuth}}"></polymer-signals>
...

This element is dynamically created in the original polymer element as follows:

var userSettings = new Element.tag('form', 'user-settings');
$['main'].children.add(userSettings);

This throws an exception:

Exception: Concurrent modification during iteration: Instance(length:4) of '_GrowableList'._notify@0x1c4cf589 (http://127.0.0.1:3030/buddy/web/packages/polymer_elements/polymer_signals/polymer_signals.dart:39:12)
<anonymous closure> (http://127.0.0.1:3030/buddy/web/packages/polymer_elements/polymer_signals/polymer_signals.dart:49:12)

If I statically create an instance of a polymer mold, I do not get this error. How can I prevent this?

+4
source share
1 answer

I can not reproduce your problem.

There are two common things that are often overlooked.

, (, ).

+2

Source: https://habr.com/ru/post/1534711/


All Articles