Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.
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
15 changes: 12 additions & 3 deletions packages/fether-react/src/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Router =
process.env.NODE_ENV === 'production' ? MemoryRouter : BrowserRouter;
const electron = isElectron() ? window.require('electron') : null;

@inject('onboardingStore')
@inject('onboardingStore', 'parityStore')
@observer
class App extends Component {
handleResize = (_, height) => {
Expand All @@ -44,9 +44,19 @@ class App extends Component {
*/
render () {
const {
onboardingStore: { isFirstRun }
onboardingStore: { isFirstRun },
parityStore: { api }
} = this.props;

// The child components make use of light.js and light.js needs to be passed
// an API first, otherwise it will throw an error.
// We set parityStore.api right after we set the API for light.js, so we
// verify here that parityStore.api is defined, and if not we don't render
// the children.
if (!api) {
return null;
}

if (isFirstRun) {
return (
<div className='window'>
Expand All @@ -59,7 +69,6 @@ class App extends Component {
<ReactResizeDetector handleHeight onResize={this.handleResize}>
<div className='content'>
<div className='window'>
{/* Don't display child components requiring RPCs if API is not yet set */}
<Router>
<Switch>
{/* The next line is the homepage */}
Expand Down
3 changes: 3 additions & 0 deletions packages/fether-react/src/stores/parityStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class ParityStore {
@observable
token = null;

@observable
api = undefined;

constructor () {
// Retrieve token from localStorage
const token = store.get(LS_KEY);
Expand Down