Form component crashes when dynamically duplicating rows (8.3.2)

Hello,

I am working with the Form component in Ignition 8.3.2 and I am trying to allow the user to dynamically add rows (a list of actions).

Currently, I am using the following script triggered by a button:

    
    logger = system.util.getLogger("myLogger")
    
    items = self.getSibling("Form_0").props.columns.items[0].rows.items
    logger.info(str(type(items)))
    import json
    itemsList = json.loads(system.util.jsonEncode(items))
    logger.info(str(type(itemsList)))
    import copy
    newItem = copy.deepcopy(itemsList[-1])
    
    itemsList.append(newItem)
    
    self.getSibling("Form_0").props.columns.items[0].rows.items = itemsList

a small part of UI it’s this (rest of UI it’s a fixed structure)

The idea is simple: when the user presses the "Adaugare Task" button, I duplicate the last row and append it to the list.

This works initially, but after several uses the UI crashes unpredictably: sometimes after 2–3 additions, sometimes after 10+ additions

On the Gateway, I don’t see any errors.

However, in the Designer I occasionally get this error:

From what I can see on designer, the items structure is correctly formed after each update, even before the crash

My questions:

  1. Is the Form component intended to support this kind of dynamic structure (adding rows at runtime)?

  2. Could the issue be related to the size/complexity of the JSON (around ~2000 rows)?

  3. Is duplicating rows like this (via JSON encode/decode + deepcopy) a problematic approach internally for Perspective?

Thanks,

Paul

Hi Paul, when previewing the page in the Designer, are you seeing any errors in the Designer’s Output Console (Tools > Console) window when this happens?

[14:38:53.739] 
[Browser Thread: 10950f11-ab88-42db-a560-6c2fe0127d9c] 
ERROR Perspective.Designer.Workspace

Level: LEVEL_ERROR

Message:
onerrorLogger:

TypeError: Cannot read properties of undefined (reading 'readEncoded')

Stack Trace:
--------------------------------------------------
TypeError: Cannot read properties of undefined (reading 'readEncoded')
    at https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:426069
    at Array.map ()
    at E.encode (https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:426059)
    at E.toEncoded (https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:423846)
    at C.readEncoded (https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:428730)
    at https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:430237
    at C.visit (https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:428013)
    at https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:424605
    at Map.forEach ()
    at T.visitChildren (https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js:2:424506)

--------------------------------------------------

Error Details:
Name: TypeError
Message: Cannot read properties of undefined (reading 'readEncoded')

Log Data:
--------------------------------------------------
msg: Uncaught Exception
errorMsg: Uncaught TypeError: Cannot read properties of undefined (reading 'readEncoded')
url: https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js
line_number: 2
column: 426069
--------------------------------------------------

Source:
https://gateway-addres/res/perspective/js/PerspectiveClient.3cf0a4e1f3ecd1e92afc.js

This is error from Console, I masked my gateway address to not make it public :smiley: