Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't it help to clone the element so that when we change the tag, we're changing it only for this one particular element and not every similar element ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would be helpful, although im not 100% sure thats the issue and i wasnt completely sure how to create a new
TemplateRef
from scratch. Its abstract so i cant instantiate a new one and when its injected im not sure how angular is handling that. TheTemplateRef
seems to be the key though.So from what i am following in the code, the reason why you've decided to swap out the tag name is because then that element will still have the inputs/outputs that are needed for the web component to bind appropriately to the container component. Instead of changing the tag name, could we just add another html element to the dom and loop through the current elements attributes to get all the bindings?
FYI, this PR didnt work completely. I added more test elements (it worked with 2) to the array but still have the race condition. Will keep looking into a solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janstadt would try to prevent introducing such logic as manual bindings behind the scene cuz that would be prolly very fragile... So what about the case of looping over X elements which are the same with same bindings, works ? Also for cloning I only thought about the last
.element
object not the wholethis.template
? Could help ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomastrajan im not sure thats possible. Im running out of ideas. I might be able to just use the other non dynamic loader with a bunch of if checks based on the user response for which modules they have access to. Clearly not optimal but would get me past this issue. It seems like there should be an easier way to do this but it doesnt seem that straight forward. I did try to create a new element like this:
At one point
nextSibling
was valued as the actualax-lazy-element
but now its always null due to the fact that the template hasnt been completely rendered at the time of the check which is unfortunate. Not sure how i was able to get it to be valued but it must have been some weird race condition yet again. Let me know if you are able to get anything working.Thanks!