aframevr / aframevr/aframe

setAttribute alters the type of data in and breaks references to an array property

Open
#3,694 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
17.6k
Forks
4.4k
PR merge metrics
No merged PRs in 30d

Description

Description:

PR #3095, which fixed #3092 wherein default values for array types were not being used, introduced cloning of array properties by converting them to JSON and back. For me, this means calling setAttribute for a component (when the array property itself is not being updated) converts an array of Date objects to an array of strings and also breaks any existing references to that array property value.

Perhaps #3092 could be solved in the schema parser instead by taking an empty string to mean "use the default" and #3095 could then be reverted. I will create this PR if you agree or if a better solution arises.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PR #3095 and issue #3092, then reproduce setAttribute on a component with an array of Date objects and an existing reference to that array. Done means preserving the array's data types and references while retaining the intended default-value behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.