gecko-dev/browser/components/newtab/content-src/activity-stream.jsx
k88hudson 7cd5393885 Bug 1486631 - Add CFR, search shortcut fixes, and bug fixes to Activity Stream r=Mardak,ursula
MozReview-Commit-ID: HZbYyg4FGwi

Differential Revision: https://phabricator.services.mozilla.com/D4392

--HG--
extra : moz-landing-system : lando
2018-08-29 14:08:31 +00:00

34 lines
1.5 KiB
JavaScript

import {actionCreators as ac, actionTypes as at} from "common/Actions.jsm";
import {addSnippetsSubscriber} from "content-src/lib/snippets";
import {ASRouterContent} from "content-src/asrouter/asrouter-content";
import {Base} from "content-src/components/Base/Base";
import {DetectUserSessionStart} from "content-src/lib/detect-user-session-start";
import {enableASRouterContent} from "content-src/lib/asroutercontent";
import {initStore} from "content-src/lib/init-store";
import {Provider} from "react-redux";
import React from "react";
import ReactDOM from "react-dom";
import {reducers} from "common/Reducers.jsm";
const store = initStore(reducers, global.gActivityStreamPrerenderedState);
const asrouterContent = new ASRouterContent();
new DetectUserSessionStart(store).sendEventOrAddListener();
// If we are starting in a prerendered state, we must wait until the first render
// to request state rehydration (see Base.jsx). If we are NOT in a prerendered state,
// we can request it immedately.
if (!global.gActivityStreamPrerenderedState) {
store.dispatch(ac.AlsoToMain({type: at.NEW_TAB_STATE_REQUEST}));
}
ReactDOM.hydrate(<Provider store={store}>
<Base
isFirstrun={global.document.location.href === "about:welcome"}
isPrerendered={!!global.gActivityStreamPrerenderedState}
locale={global.document.documentElement.lang}
strings={global.gActivityStreamStrings} />
</Provider>, document.getElementById("root"));
enableASRouterContent(store, asrouterContent);
addSnippetsSubscriber(store);