openHASP icon indicating copy to clipboard operation
openHASP copied to clipboard

jsonl parsing - duplicate objects

Open smcgann99 opened this issue 4 months ago • 0 comments

Perform all steps below and tick them with [x]

  • [X] Check the related part of the Documentation
  • [X] Update openHASP to the latest version
  • [X] Reproduce the issue and describe all steps

Describe the bug

Sending jsonl for an object twice should first add and then update attributes for the existing object, However when changing its parentid it then creates a second object with the same id, also then allows for obj type to change, so I can create a label and a button with the same id on the same page, in 2 different parents.

To Reproduce

  { "page": 2, "id": 1, "x": 0, "y": 0, "h": 100, "w": 100, "obj": "label", "text": "parent 1", "bg_color": "#DfDf00", "bg_opa": 255 },
  { "page": 2, "id": 2, "x": 110, "y": 110, "h": 100, "w": 100, "obj": "label", "text": "parent 2", "bg_color": "#DfDf00", "bg_opa": 255 },
  { "page": 2, "parentid": 1, "id": 3, "x": 20, "y": 20, "h": 40, "w": 40, "obj": "label", "text": "child", "bg_color": "#550000", "bg_opa": 255 },
  { "page": 2, "parentid": 2, "id": 3, "x": 20, "y": 20, "h": 40, "w": 40, "obj": "btn", "text": "child", "bg_color": "#550000", "bg_opa": 255 },

Expected behaviour

A second object should not be created, the original object should just be updated.

Screenshots or video

smcgann99 avatar Oct 12 '24 15:10 smcgann99