Skip to content

Commit

Permalink
[sitecore-embedded-jss-app] Remove usage of SitecoreContextFactory (#466
Browse files Browse the repository at this point in the history
)

* [sitecore-embedded-jss-app] Remove SitecoreContextFactory
  • Loading branch information
sc-illiakovalenko authored Oct 7, 2020
1 parent 0f96b6e commit 9a0477a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 12 deletions.
3 changes: 1 addition & 2 deletions samples/sitecore-embedded-jss-app/src/boot/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import 'babel-polyfill';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { SitecoreContext } from '@sitecore-jss/sitecore-jss-react';
import SitecoreContextFactory from './SitecoreContextFactory';
import componentFactory from '../app/componentFactory';
import App from '../app';

class Root extends Component {
render() {
return (
<SitecoreContext componentFactory={componentFactory} contextFactory={SitecoreContextFactory}>
<SitecoreContext componentFactory={componentFactory} context={this.props.initialState.sitecore.context}>
<App route={this.props.initialState.sitecore.route} />
</SitecoreContext>
);
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions samples/sitecore-embedded-jss-app/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import ReactDOM from 'react-dom';
import Root from './boot/Root';
import SitecoreContentService from './boot/SitecoreContentService';
import SitecoreContextFactory from './boot/SitecoreContextFactory';

/* eslint-disable no-underscore-dangle */

Expand Down Expand Up @@ -38,9 +37,5 @@ if (window.__data) {

// render with initial route data
SitecoreContentService.getRouteData('/EmbeddedWizard/Wizard').then((routeData) => {
if (routeData && routeData.sitecore && routeData.sitecore.context) {
SitecoreContextFactory.setSitecoreContext(routeData.sitecore.context);
}

return render(routeData, window.__data ? ReactDOM.hydrate : ReactDOM.render);
});
2 changes: 0 additions & 2 deletions samples/sitecore-embedded-jss-app/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import ReactDOM from 'react-dom/server';
import initialState from 'boot/initialState';
import Root from 'boot/Root';
import SitecoreContentService from 'boot/SitecoreContentService';
import SitecoreContextFactory from 'boot/SitecoreContextFactory';
import ServerHtml from 'app/ServerHtml';

/*
Expand All @@ -23,7 +22,6 @@ export function renderView(callback, path, data, viewBag) {
// get the route data and then render from it
SitecoreContentService.getRouteData(path)
.then((routeData) => {
SitecoreContextFactory.setSitecoreContext(routeData.sitecore.context);
return <Root initialState={routeData} path={path} />;
})
.then((content) => {
Expand Down

0 comments on commit 9a0477a

Please sign in to comment.