Details
Description
During preview, objects on a document are currently only updated but neither are objects added that are specified in the form nor are objects removed that are specified in the form as to be removed. Further, also the objectPolicy updateOrCreate is not considered. This makes it impossible to preview a document for which new objects shall be created or removed as part of the edit form.
A fix would be to also add and remove objects during the preview action. This might break existing code that relies on objects not being added or removed while the edit form or preview are rendered. This should not break code using the updateOrCreate object policy though but only code that creates inputs that create or remove objects explicitly like the object editor (which doesn't support preview, though).
I assume that this bug is as old as, e.g., the updateOrCreate object policy introduced in XWIKI-10252 which is why I put the fix version of that issue as affected version.