New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception: Already registered (Polymer) prototype for element h-select-item (package:polymer/src/instance.dart:170) #21439
Comments
Issue #21438 has been merged into this issue. |
Hi, I haven't tried the example directly, but it sounds like the problem here is the path you have to import a shared component. HTML imports are picky and will only recognize that two imports are loading the same file if the imports resolve to the same URL. Because HTML imports know nothing about Dart, they don't know that a url to "../lib" or a URL to "packages/package_name/" are the same. So you can easily run into a problem with imports that use the form "../lib". That's why we encourage that you use "packages/" urls instead. This is similar to how in Dart we use "package:foo/x.dart" and not "../lib/x.dart", so that everyone uses the same URL to reach the library. You can find more details on what we do/recommend in this article: https://www.dartlang.org/polymer/app-directories.html <link href = '../lib/component/...' rel = 'import'> use "packages/polymer_prototype_bug" (the name of your package): <link href = 'packages/polymer_prototype_bug/component/...' rel = 'import'> Cheers! Added AsDesigned label. |
This comment was originally written by dart.dev.c...@gmail.com Hi sigmund, <link href = 'packages/polymer_prototype_bug/component/description_form.html' rel = 'import'> I made the changes you suggested but the result is the same - Exception: Already registered (Polymer) prototype for element h-select-item (package:polymer/src/instance.dart:170) |
Hey dart.dev.clarke - I was finally able to try your example, and I can see that the problem is triggered from the html_components package. It seems that 'package:html_components/input/select_checkbox_menu.dart' has an export of 'package:html_components/input/select_item.dart', which makes us incorrectly register h-select-item twice (the first time when when we discover it from select_item.html, and the second time when we see that export). Technically it is not incorrect to have that export, so we need to add some more logic to the polymer transformers to handle this special case. If you are the owner of that package, though, and would like to continue making progress without waiting for a fix, then changing the code to remove the export will fix the issue (I just tried that locally and it seemed to work). Removed Pkg-Polymer label. |
This comment was originally written by dart.dev.c...@gmail.com Thanks Sigmund. About when will a fix be available from the polymer side? Cheers |
Honestly I was hoping I could look this week but I haven't had a chance to do so yet. I'll keep you posted. Meanwhile there are two hacky tricks you can do to work around the problem: - you can download the html_component package, modify it locally and depend on your local copy using a path dependency or dependency_override. - you can add a transformer that runs after polymer and remove one line from the generated code. If you run Cheers |
This comment was originally written by dart.dev.clark...@gmail.com Hello Sigmund, Cheers |
I just sent a CL out for review: https://codereview.chromium.org/700733002/ Added Started label. |
fix submitted, I am assuming this is fixed now Set owner to @sigmundch. |
Yes :) - The fixed package is now available in version 0.15.1+4 from pub. |
This comment was originally written by dart.dev.clark...@gmail.com The fixed package is now available in version 0.15.1+4 from pub. Thanks |
The fix is also there in 0.15.1+5. I verified your example above, and seems to be working here with 0.15.1+5. I noticed that pub-serve may be caching results of building code in the .pub folder under your project root. It worked for me after I deleted the |
This issue has been moved to dart-archive/polymer-dart#450. |
This issue was originally filed by dart.dev.c...@gmail.com
Had problems with previous submission - this is the intended submission. Cannot find how to delete previous submission. Apologies.
What steps will reproduce the problem?
<!--<link href = '../lib/component/unit_form.html' rel = 'import'> -->
Exception: Already registered (Polymer) prototype for element h-select-item (package:polymer/src/instance.dart:170)
What is the expected output? The paper-input as shown plus an html_component of select_checkbox_menu.html containing checkboxes corresponding to the values in the map -
@observable
Map<String, String> unitSelectItems =
{
'mm': 'mm',
'cm': 'cm',
'm': 'm',
'litre': 'liter',
'inches': 'inches',
'foot': 'foot',
'feet': 'feet',
'pint': 'pint',
'quart': 'quart',
'cup': 'cup',
'minute': 'minute',
'hour': 'hour',
'day': 'day',
'month': 'month',
'year': 'year'
};
found in the unit_form.dart.
An example of how the custom-element should appear can be found at http://szgabsz91.github.io/html-components/#/input/select-checkbox-menu. Click on the drop-down arrow of the 'Movies' below the line Select Checkbox Menu.
Please include the following information:
Attachment:
polymer_prototype_bug.zip (13.43 KB)
The text was updated successfully, but these errors were encountered: