Non valid content created via api doesnt show up in Content Studio

Enonic version: 6.5.3

If you create an invalid content (ie. required field not filled in) via the JavaScript API, the content will not show up in content editor. This makes it possible for “invisible” content to block other content from being created due to name collision.

1 Like

Hello Lasse.

Could you export the content branch where this happens and send to me at [email protected]?

Are you sure the content is not being created directly on the master branch? Should create it in draft branch first and then use contentLib.publish.

Entire content tree or just the content where it happens?

That might be? Im not specifying any branch when creating (as suggested by the API), but working on master.

Is content only displayed in content studio if its in draft branch?

If content is created in the master branch then it’s not visible in the Content Studio. When there is user-generated content that needs to appear online immediately then it should be created in draft and published to master in the controller. So this issue probably has nothing to do with invalid content.

1 Like

So it seems like this might be the case. However, i cant seem find any documentation saying master branch is hidden.

ContentLib documentation also suggests to use default branch ("branch - Set by portal, depending on context, to either draft or master. May be overridden, but this is not recommended. Default is the current branch set in portal."). This will in almost all cases be master and you will end up with a lot of invisible content.

This seems a bit weird to me. Any explanation on why its done like this? Any idea how to fix it?

This also becomes a bit awkward when editing content on master branch. The content will be set to “Out-of-date”. Seemingly without any way of seeing the actual published content in admin.

It seems like the intended flow is to always add and edit stuff on draft branch then publish to master but this isn’t very clear in the documentation. It also seems to be hard to work on a different branch than the current context in a java bean, since the context is automatically set (with no obvious way to override).

To set the context, use the!/module-lib_xp_context.html

When working with content, there are as you say two branches; draft and master. I agree that we should have some way in admin to see whats happening in the master-branch, and we have talked about it.

The contextual branch is used by default - developers storing user generated content in The cms-repo should explicitly write to The draft branch and then publish to The master branch. This way you will never see conflicts ala Git.