And to be ultra precise, here is the error I am getting. Note I have not changed the code and it was working fine in my previous version of MW.
In my extension module, I have implemented the function insertTransclusionNode
. In it, when inserting a new node, once I have build my object (getPlainObject
), I call the following function
surfaceFragment.insertContent( [{type: 'gacdmslinker',attributes: {mw: obj,calaction: 'insert'}},{ type: '/gacdmslinker' }] );
and this is when I get the following error:
VM522:28 Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'VeDmDocument'
| property 'bindings' -> object with constructor 'Object'
| property 'transact' -> object with constructor 'Array'
| ...
| property 'context' -> object with constructor 'VeDmInternalList'
--- property 'document' closes the circle
at JSON.stringify (<anonymous>)
at ve.dm.Surface.storeChanges (load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=1lvvz:180:941)
at OO.EventEmitter.emit (<anonymous>:28:656)
at ve.dm.Surface.breakpoint (load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=1lvvz:175:902)
The weird thing is, my object (gacdmslinkernode) is still created in the sense that, if I save the document and re-edit it with VE, it shows up correcly. However, the error seems to be preventing the insertion of the title of the object (but not of the associated icon) and instead it uses the page title as the title. And also, when I update an existing node, I get no error and it works fine.