Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Large post-registration imports can lead to incomplete icon maps #66

Open
1 of 8 tasks
tiwijo opened this issue Apr 11, 2017 · 5 comments
Open
1 of 8 tasks

Large post-registration imports can lead to incomplete icon maps #66

tiwijo opened this issue Apr 11, 2017 · 5 comments

Comments

@tiwijo
Copy link

tiwijo commented Apr 11, 2017

Description

When importing a large HTML bundle, Chrome can parse it in pieces. If an iron-iconset-svg definition is broken across multiple pieces, then only the icons in the first piece (the one with the opening tag) are available in the icon map. Other icons will be blank.

Expected outcome

The icon map should be complete. Either wait until the closing tag or incrementally build the icon map.

Actual outcome

The icon map is incomplete, containing only the icons in the same piece of HTML that has the opening tag. Note this doesn't happen if you HTML import first, then register because HTML imports should block.

Live Demo

Steps to reproduce

  1. Register the iron-iconset-svg component.
  2. Import a large HTML bundle. Not sure the best way to get it to parse in pieces, but perhaps loading the main thread with work might help.
  3. Observe the icon map is incomplete. You can also look at the timeline in dev tools to confirm the HTML bundle has been parsed in pieces.

Browsers Affected

This was detected in Chrome. I haven't tried in other browsers.

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10
@stramel
Copy link

stramel commented Jan 23, 2018

I am also getting this issue. The referenced PR does fix it but I'm not sure it is the best fix.

UPDATE: Seems related to the use of async attribute on the HTML Imports.

@andrey-git
Copy link

async is not required for this to break. It can happen due to chunking without async
@bicknellr is something missing from my solution?

@trading-peter
Copy link

I experienced the same problem and messed around to find solutions. Is it possible that replacing the async in https://github.com/PolymerElements/iron-iconset-svg/blob/master/iron-iconset-svg.html#L188 with Polymer.RenderStatus.afterNextRender(this, ...) would solve this issue? I wasn't able to reproduce the problem after.

If I'm right here this would maybe be a more elegant fix than working with the DOMContentLoaded event as done in the open pr?

@Tronil
Copy link

Tronil commented Oct 5, 2018

Note that I have encountered this problem with a small iconset only containing 4 simple svg icons (using Chrome 69) - so the problem is not limited to large imports it would seem.
Calling getIconNames() in a iron-iconset-added event handler gives me an empty list in this case so the parsing doesn't seem to be done yet.

@balloob
Copy link

balloob commented Oct 5, 2018

We fixed this by extending the original class and patching the fix in: https://github.com/home-assistant/home-assistant-polymer/blob/master/src/components/ha-iconset-svg.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants