Skip to content
Permalink
Browse files

Misc fixes (#863)

* fix: revert relative feed icon size

* fix: initial feed default value of empty array in case of error

* add: log warn axios response errors

* add: set version in analytics
fix: amplitude error log

* fix: config.js defaults

* fix: snapshots

* add: silent testing
  • Loading branch information...
sirpy committed Nov 7, 2019
1 parent 33cf7f8 commit 9da62802ccb2ac3a3fa55072a4129963b8748111
@@ -1,5 +1,5 @@
REACT_ENV=development
REACT_APP_LOG_LEVEL=trace
REACT_APP_LOG_LEVEL=silent
REACT_APP_SERVER_URL=http://localhost:3003
REACT_APP_GUN_PUBLIC_URL=http://localhost:8765/gun
REACT_APP_INFURA_KEY=
@@ -81,8 +81,8 @@ const getStylesFromProps = ({ theme }) => ({
marginBottom: 15,
},
mainImage: {
height: getDesignRelativeHeight(110, false),
width: getDesignRelativeWidth(70, false),
height: getDesignRelativeHeight(110, true),
width: getDesignRelativeWidth(70, true),
},
mainPhotoContainer: {
display: 'flex',
@@ -1771,11 +1771,11 @@ exports[`FeedModalItem - Send matches snapshot 1`] = `
Object {
"WebkitFlexBasis": "auto",
"flexBasis": "auto",
"height": "137.14285714285714px",
"height": "110px",
"msFlexPreferredSize": "auto",
"overflowX": "hidden",
"overflowY": "hidden",
"width": "199.11111111111111px",
"width": "70px",
"zIndex": 0,
}
}
@@ -2707,11 +2707,11 @@ exports[`FeedModalItem - Send with Error status matches snapshot 1`] = `
Object {
"WebkitFlexBasis": "auto",
"flexBasis": "auto",
"height": "137.14285714285714px",
"height": "110px",
"msFlexPreferredSize": "auto",
"overflowX": "hidden",
"overflowY": "hidden",
"width": "199.11111111111111px",
"width": "70px",
"zIndex": 0,
}
}
@@ -3644,11 +3644,11 @@ exports[`FeedModalItem - Withdraw matches snapshot 1`] = `
Object {
"WebkitFlexBasis": "auto",
"flexBasis": "auto",
"height": "137.14285714285714px",
"height": "110px",
"msFlexPreferredSize": "auto",
"overflowX": "hidden",
"overflowY": "hidden",
"width": "199.11111111111111px",
"width": "70px",
"zIndex": 0,
}
}
@@ -11,9 +11,9 @@ const Config = {
publicUrl,
infuraKey: process.env.REACT_APP_INFURA_KEY,
network: process.env.REACT_APP_NETWORK || 'fuse',
market: process.env.REACT_APP_MARKET || process.env.REACT_APP_MARKET === 'etoro',
market: process.env.REACT_APP_MARKET || process.env.REACT_APP_NETWORK === 'etoro',
marketUrl: process.env.REACT_APP_MARKET_URL || 'https://goodmarket.gooddollar.org',
isEToro: process.env.REACT_APP_NETWORK === 'etoro',
isEToro: process.env.REACT_APP_ETORO || process.env.REACT_APP_NETWORK === 'etoro',
zoomLicenseKey: process.env.REACT_APP_ZOOM_LICENSE_KEY,
amplitudeKey: process.env.REACT_APP_AMPLITUDE_API_KEY,
rollbarKey: process.env.REACT_APP_ROLLBAR_API_KEY,
@@ -59,7 +59,7 @@ class API {
},
e => {
// Do something with response error
log.error('axios req error', e.message, e)
log.warn('axios req error', e.message, e)
return Promise.reject(e)
}
)
@@ -69,7 +69,7 @@ class API {
},
e => {
// Do something with response error
log.error('axios response error', e.message, e)
log.warn('axios response error', e.message, e)
if (e.response && e.response.data) {
return Promise.reject(e.response.data)
}
@@ -47,6 +47,7 @@ export const initAnalytics = async (goodWallet: GoodWallet, userStorage: UserSto
captureUnhandledRejections: true,
payload: {
environment: Config.env,
codeVersion: Config.version,
person: {
id: emailOrId,
identifier,
@@ -58,6 +59,7 @@ export const initAnalytics = async (goodWallet: GoodWallet, userStorage: UserSto
if (global.amplitude && Config.amplitudeKey) {
Amplitude = global.amplitude.getInstance()
Amplitude.init(Config.amplitudeKey)
Amplitude.setVersionName(Config.version)
if (Amplitude) {
const created = new Amplitude.Identify().setOnce('first_open_date', new Date().toString())
if (email) {
@@ -90,16 +92,6 @@ export const fireEvent = (event: string, data: any = {}) => {
return
}

switch (event) {
case ERROR_LOG:
data = { reason: data && data[1] ? data[1] : '' }
break

default:
break
}

data.version = Config.version
let res = Amplitude.logEvent(event, data)

if (res === undefined) {
@@ -130,7 +122,7 @@ const patchLogger = () => {
global.logger.error = function() {
let [logContext, logMessage, eMsg, errorObj, ...rest] = arguments
if (arguments[1] && arguments[1].indexOf('axios') == -1) {
debounceFireEvent('ERROR_LOG', arguments)
debounceFireEvent(ERROR_LOG, { reason: logMessage || eMsg, logContext })
}
if (global.Rollbar && Config.env !== 'test') {
global.Rollbar.error(logMessage, errorObj, { logContext, eMsg, rest })
@@ -62,9 +62,10 @@ const getMockFeeds = () => {
const getInitial = async (store: Store) => {
logger.debug('getFeed')
store.set('feedLoading')(true)
const feeds = await userStorage
.getFormattedEvents(PAGE_SIZE, true)
.catch(e => logger.error('getInitialFeed -> ', e.message, e))
const feeds =
(await userStorage
.getFormattedEvents(PAGE_SIZE, true)
.catch(e => logger.error('getInitialFeed -> ', e.message, e))) || []
logger.info({ feeds })
const mockedFeeds = getMockFeeds()
store.set('feedLoading')(false)

0 comments on commit 9da6280

Please sign in to comment.
You can’t perform that action at this time.