Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sitecore-embedded-jss-app] Remove usage of SitecoreContextFactory #466

Merged
merged 2 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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