Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit 5c1460b

Browse files
authored
Merge pull request #1890 from blockstack/hotfix/home-page-apps-crash
Fix home page apps issues
2 parents 9b72e2f + 680dc65 commit 5c1460b

File tree

4 files changed

+40
-41
lines changed

4 files changed

+40
-41
lines changed

app/js/App.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ function mapStateToProps(state) {
3939
walletPaymentAddressUrl: state.settings.api.walletPaymentAddressUrl,
4040
coreAPIPassword: state.settings.api.coreAPIPassword,
4141
instanceIdentifier: state.apps.instanceIdentifier,
42-
lastUpdatedApps: selectLastUpdatedApps(state)
42+
lastUpdatedApps: selectLastUpdatedApps(state),
43+
topApps: state.apps.topApps
4344
}
4445
}
4546

46-
const mapDispatchToProps = dispatch => {
47-
return bindActionCreators(
47+
const mapDispatchToProps = dispatch => bindActionCreators(
4848
{
4949
updateApi: SettingsActions.updateApi,
5050
isCoreRunning: SanityActions.isCoreRunning,
@@ -54,7 +54,6 @@ const mapDispatchToProps = dispatch => {
5454
},
5555
dispatch
5656
)
57-
}
5857

5958
class AppContainer extends Component {
6059
static propTypes = {
@@ -80,7 +79,8 @@ class AppContainer extends Component {
8079
router: PropTypes.object.isRequired,
8180
location: PropTypes.object.isRequired,
8281
instanceIdentifier: PropTypes.string,
83-
lastUpdatedApps: PropTypes.number
82+
lastUpdatedApps: PropTypes.number,
83+
topApps: PropTypes.array
8484
}
8585

8686
constructor(props) {
@@ -166,7 +166,7 @@ class AppContainer extends Component {
166166
}
167167

168168
if (
169-
!this.props.lastUpdatedApps ||
169+
!this.props.lastUpdatedApps || !this.props.topApps ||
170170
Date.now() - this.props.lastUpdatedApps > 900000 // 15 min
171171
) {
172172
// Fetch those apps if data is state

app/js/HomeScreenPage.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const AppItem = ({ website, imgixImageUrl, name, description }) => {
139139
size="64px"
140140
display="block"
141141
flexShrink="0"
142-
src={imgixImageUrl}
142+
src={`${imgixImageUrl}?auto=format&w=128&q=50`}
143143
alt={name}
144144
/>
145145
<Box ml={[0, 3, 3, 3]} mt={[3, 0, 0, 0]}>
@@ -188,7 +188,8 @@ class HomeScreenPage extends React.Component {
188188
render() {
189189
const loading =
190190
this.props.apps &&
191-
this.props.apps.loading &&
191+
this.props.apps.loading ||
192+
!this.props.apps.topApps ||
192193
!this.props.apps.topApps.length
193194
return (
194195
<Box>

app/js/store/apps/actions.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as types from './types'
22
import log4js from 'log4js'
33
import { randomBytes, createHash } from 'crypto'
44

5-
const API_URL = 'https://app-co-api.herokuapp.com'
5+
const API_URL = 'https://api.app.co'
66

77
const logger = log4js.getLogger(__filename)
88

@@ -33,8 +33,7 @@ const refreshAppList = (
3333
browserApiUrl,
3434
instanceIdentifier,
3535
instanceCreationDate
36-
) => {
37-
return dispatch => {
36+
) => dispatch => {
3837
logger.info('refreshAppList')
3938
if (instanceIdentifier) {
4039
return fetch(
@@ -52,7 +51,6 @@ const refreshAppList = (
5251
return null
5352
}
5453
}
55-
}
5654

5755
const generateInstanceIdentifier = () => {
5856
logger.info('Generating new instance identifier')

package-lock.json

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)