aframe icon indicating copy to clipboard operation
aframe copied to clipboard

Fixes dynamically created a-scene attributes

Open rockwalrus opened this issue 3 years ago • 3 comments

Description: document.createElement("a-scene").setAttribute doesn't work correctly when there is already a registered system and component with the same name.

Changes proposed:

  • Call the ANode implementation if there are no systemNames yet.

rockwalrus avatar Aug 22 '22 20:08 rockwalrus

Thanks. Can you provide a concrete example of expected vs. what you get behavior?

dmarcos avatar Aug 22 '22 23:08 dmarcos

Well, the test case shows the issue pretty well. What happens if you create your a-scene after A-Frame initializes is that in certain cases some of the attributes on the element never get set, leading to misconfigured systems. I noticed this with gltf-model but it's true at least for all attributes that correspond to systems with the same name as their associated component.

My expectation is that A-Frame should handle system attributes correctly regardless of whether a-scene is created before or after A-Frame initializes. Note that I'm only ever creating one a-scene and this is the only apparent problem with dynamically creating it.

rockwalrus avatar Aug 22 '22 23:08 rockwalrus

Can you provide some code that reproduces the issue? https://glitch.com/~aframe highly recommended

dmarcos avatar Aug 25 '22 18:08 dmarcos

It's at https://aframe-dynamic-system-bug.glitch.me . Check the console logs to see the problem.

rockwalrus avatar Nov 15 '22 18:11 rockwalrus