4

How can I update my YAML files for local disconnected mode development from Sitecore, as same as Connected mode. As We have a team who is working on Sitecore and another team is working on front-end in disconnected mode. I know we can use :connected mode for development but I need the same data in disconnected mode also. How can I update that .yml files.

  • Nice idea for a module: Unicorn YML -> JSS Disconnected YML :-) – Steve McGill Jan 18 at 11:57
  • anyone have the solution or please share any idea or any link/blog that helps. I need it badly. – user10086702 Jan 21 at 8:01
0

There are no tools built into the JSS SDK to retrieve and store Layout Service data as files.

When disconnected data is imported into Sitecore, it is "expanded" to reflect the data schemas you have defined in disconnected mode. In other words, component definitions, route data, content data and everything else you define in disconnected mode become templates, renderings, data source items, etc... in Sitecore.

At that point, it becomes extremely difficult to "export" everything that has been expanded and make it available again as disconnected data in the same/similar structure as you defined it originally in disconnected mode. This is especially true for shared data/components.

If you have backend/frontend teams working in tandem on a JSS site / Sitecore instance, it is recommended that you try to use Connected mode in this scenario. Also, once Sitecore becomes the "source of truth" for your data, be sure to exercise caution if importing templates/components/renderings (e.g. disconnected data) into Sitecore so as not to break anything the backend team may have implemented.

All of that said, your JSS app is essentially built to consume and render data made available via Layout Service. And you are not required to use the mock Layout Service that the sample apps use. There is nothing preventing you from saving Layout Service data queried from Sitecore into a JSON file. Once you have that data locally (disconnected), you might consider building your own service layer to fetch "raw" Layout Service data from the JSON file(s) you saved.

For instance, wherever you currently call dataApi.fetchRouteData, you can add a conditional statement, e.g.

if (inDisconnectedMode) {
  fetchRouteDataFromLocalFile();
} else {
  dataApi.fetchRouteData();
}

Related question (but similar answer: Any way to remove disconnected manifest processing?)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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