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

(Bug) #1052 Prevent to run multiple transaction #1053

Merged
merged 8 commits into from
Dec 18, 2019
8 changes: 6 additions & 2 deletions src/components/dashboard/SendQRSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const SendQRSummary = ({ screenProps }: AmountProps, params) => {
const faceRecognition = () => {
return screenProps.push('FRIntro', { from: 'SendQRSummary' })
}

const sendGD = () => {
try {
setLoading(true)
Expand Down Expand Up @@ -92,10 +93,15 @@ const SendQRSummary = ({ screenProps }: AmountProps, params) => {
buttons: [{ text: 'Yay!' }],
onDismiss: screenProps.goToRoot,
})

setLoading(false)

return hash
},
onError: e => {
log.error('Send TX failed:', e.message, e)

setLoading(false)
userStorage.markWithErrorEvent(txhash)
},
})
Expand All @@ -107,8 +113,6 @@ const SendQRSummary = ({ screenProps }: AmountProps, params) => {
message: `There was a problem sending G$. Try again`,
dismissText: 'OK',
})
} finally {
setLoading(false)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/__tests__/SendQRSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import renderer from 'react-test-renderer'
import { getWebRouterComponentWithMocks } from './__util__'

describe('OutOfGasError', () => {
describe('SendQRSummary', () => {
it('renders without errors', () => {
const SendQRSummary = getWebRouterComponentWithMocks('../SendQRSummary')
let component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`OutOfGasError matches snapshot 1`] = `
exports[`SendQRSummary matches snapshot 1`] = `
<div
className="css-view-1dbjc4n"
style={
Expand Down
19 changes: 19 additions & 0 deletions src/components/profile/__tests__/OptionsRow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import renderer from 'react-test-renderer'
import { withThemeProvider } from '../../../__tests__/__util__'
import OptionsRow from '../OptionsRow'

describe('ViewAvatar', () => {
const WrappedOptionsRow = withThemeProvider(OptionsRow)

it('renders without errors', () => {
const tree = renderer.create(<WrappedOptionsRow />)
expect(tree.toJSON()).toBeTruthy()
})

it('matches snapshot', () => {
const component = renderer.create(<WrappedOptionsRow />)
const tree = component.toJSON()
expect(tree).toMatchSnapshot()
})
})
169 changes: 169 additions & 0 deletions src/components/profile/__tests__/__snapshots__/OptionsRow.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ViewAvatar matches snapshot 1`] = `
<div
className="css-view-1dbjc4n"
style={
Object {
"WebkitBoxFlex": 1,
"WebkitFlexBasis": "0%",
"WebkitFlexGrow": 1,
"WebkitFlexShrink": 1,
"flexBasis": "0%",
"flexGrow": 1,
"flexShrink": 1,
"msFlexNegative": 1,
"msFlexPositive": 1,
"msFlexPreferredSize": "0%",
}
}
>
<div
className="css-view-1dbjc4n"
style={
Object {
"WebkitAlignItems": "center",
"WebkitBoxAlign": "center",
"WebkitBoxDirection": "normal",
"WebkitBoxOrient": "horizontal",
"WebkitFlexDirection": "row",
"alignItems": "center",
"borderBottomColor": "rgba(238,238,238,1.00)",
"borderBottomStyle": "solid",
"borderBottomWidth": "1px",
"display": "flex",
"flexDirection": "row",
"msFlexAlign": "center",
"msFlexDirection": "row",
"paddingBottom": "8px",
"paddingLeft": "32px",
"paddingRight": "8px",
"paddingTop": "8px",
}
}
>
<div
className="css-text-901oao"
dir="auto"
style={
Object {
"WebkitBoxFlex": 2,
"WebkitFlexGrow": 2,
"color": "rgba(85,85,85,1.00)",
"direction": "ltr",
"flexGrow": 2,
"fontFamily": "Roboto",
"fontSize": "16px",
"fontWeight": "500",
"lineHeight": "22px",
"msFlexPositive": 2,
"textAlign": "left",
"textDecoration": "none",
"textTransform": "none",
}
}
>

</div>
<div
className="css-view-1dbjc4n"
style={
Object {
"WebkitAlignItems": "center",
"WebkitBoxAlign": "center",
"alignItems": "center",
"minWidth": "60px",
"msFlexAlign": "center",
"width": "15%",
}
}
>
<div
className="css-text-901oao"
dir="auto"
style={
Object {
"color": "rgba(85,85,85,1.00)",
"direction": "ltr",
"fontFamily": "Roboto",
"fontSize": "14px",
"fontWeight": "normal",
"lineHeight": "20px",
"textAlign": "center",
"textDecoration": "none",
"textTransform": "none",
}
}
>
Private
</div>
</div>
<div
className="css-view-1dbjc4n"
style={
Object {
"WebkitAlignItems": "center",
"WebkitBoxAlign": "center",
"alignItems": "center",
"minWidth": "60px",
"msFlexAlign": "center",
"width": "15%",
}
}
>
<div
className="css-text-901oao"
dir="auto"
style={
Object {
"color": "rgba(85,85,85,1.00)",
"direction": "ltr",
"fontFamily": "Roboto",
"fontSize": "14px",
"fontWeight": "normal",
"lineHeight": "20px",
"textAlign": "center",
"textDecoration": "none",
"textTransform": "none",
}
}
>
Masked
</div>
</div>
<div
className="css-view-1dbjc4n"
style={
Object {
"WebkitAlignItems": "center",
"WebkitBoxAlign": "center",
"alignItems": "center",
"minWidth": "60px",
"msFlexAlign": "center",
"width": "15%",
}
}
>
<div
className="css-text-901oao"
dir="auto"
style={
Object {
"color": "rgba(85,85,85,1.00)",
"direction": "ltr",
"fontFamily": "Roboto",
"fontSize": "14px",
"fontWeight": "normal",
"lineHeight": "20px",
"textAlign": "center",
"textDecoration": "none",
"textTransform": "none",
}
}
>
Public
</div>
</div>
</div>
</div>
`;
4 changes: 3 additions & 1 deletion src/lib/gundb/UserStorageClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,9 @@ export class UserStorage {
feed
.filter(
feedItem =>
feedItem.data && ['deleted', 'cancelled'].includes(feedItem.status || feedItem.otplStatus) === false
feedItem &&
sirpy marked this conversation as resolved.
Show resolved Hide resolved
feedItem.data &&
['deleted', 'cancelled'].includes(feedItem.status || feedItem.otplStatus) === false
)
.map(feedItem => {
if (!(feedItem.data && feedItem.data.receiptData)) {
Expand Down