Harald_Korneliussen
8 months agoIdeator I
Item.apply overwriting action, has it always done this?
After upgrading from version 12 to 31, we started getting an error when saving a certain custom datastructure, developed for us by Minerva back in the day:
Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'.
From what I can tell, this happens because Minerva's old code calls an action directly on the document.thisItem object
var output = document.thisItem.apply("VE_GetCopyTreeGridHeader");
which "pollutes" document.thisItem with that action. When later hitting save, it calls this function instead of doing whatever it ordinarily would (probably a get action), resulting in the error. I observe that if I change the action to "get", it gets rid of the error message and saves any changes in the object itself, but not in a related items treegrid associated with it. If I change the Iaction to "update", it saves everything correctly the way it used to do in version 12.
I see that the docs on item apply says that it overwrites the action, but if it always did that, how did this code ever work? (By the way, that .apply() overwrites the action is an error-prone side effect which I can't see any good reason for)