0

Environment:

  • Sitecore 9.0 update-1
  • SitecoreJSS 11.0.0

I created a sample SitecoreJSS app (using Angular), and created a new JSS component using jss scaffold <NewcomponentName>. I want to add this new component on the AppRoute page by-default (just like pageTitle).

So I added inherits: ['Route', 'NewcomponentName'], to the "routes.sitecore.ts" file and deployed to JSS app. It worked just fine, but if I filled out the data in sitecore and if I re-deploy the app again it's resetting/emptying sitecore fields.

enter image description here

Thanks in Advance.

0

This is expected, by default all your JSS app items will be "JSS Development Workflow". So when you deploy your App first time all items will be in "Development Mode".

enter image description here

So whenever you run the below/relevant commands, all your yml/yaml will overwrite respective items in Sitecore and you will loose if you made any update in Sitecore directly.

jss deploy app --includeContent
jss deploy items --includeContent

Refer the warnings in any of the item which you updated in Sitecore but not in final state of workflow, it explains.

enter image description here

To avoid this you may need to execute/manage workflow effectively. Check your "Review" tab, if you don't want your jss build to update item then just move it to "Content Mode" which denies access to import user and next build will not overwrite. Also if it is "Published" the content will not be overwritten because "Sitecore\JSS Import Service Users" doesn't have "Workflow State Write" access which is needed to update items when they are in a specific workflow state.

Sitecore documentation will have lot of additional details about workflow states/security and code-first approach etc.

Development Mode - Import can overwrite field values and route item layout.

Content Mode - Import user is denied item write access. Import will skip writes on the item. For route items, this means that any rendering changes or updates to datasource items are also skipped.

|improve this answer|||||
  • That's what I thought, but there are couple of pages that are in published state and it reset on those pages too. I attached an image of my sitecore on the question. – Neal Caffrey Feb 25 at 20:42
  • Do you see this warning message in those items "The current item is allowed to be overwritten during next import." – Gobinath Saminathan Feb 25 at 21:41
  • Just corrected , if you move to "Content Mode" then the import user will not have access. Try this. – Gobinath Saminathan Feb 25 at 21:57
  • Most of the pages are in the Published mode and there is no warning message on those items. I noticed one thing, when I deploy the app some times it's resetting those pages (published mode) and sometimes not. But the "Home" page is getting reset every-time even though it's in published mode. – Neal Caffrey Feb 26 at 15:29
  • Do you have any custom security setup.? may be try setting deny write access specifically to the item/root for import user "Sitecore\JSS Import Service Users". Or specifically deny "Workflow State Write" for the above user in "Published" state. – Gobinath Saminathan Feb 26 at 16:02
0

Created Sitecore ticket and they are able to reproduce my issue on their environment. But they didn't provide any fix/solution(they said they are communicating their Product Department regarding this scenario).

Temporary solution (from Sitecore):

To achieve this desired result, rather than making the default route inherit your custom components, you should create a custom route type. Custom route types will inherit the default route type automatically and can contain data fields, however unlike components these fields are shared at the route level.

Thanks - Neal

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.