on master help sign in
fix: correctly pop and then push routes within statelesstransaction
9aab1feMatt Condon (shrugs)
src/bridge/components/StatelessTransaction.js+2−2
@@ -236,14 +236,14 @@ class StatelessTransaction extends React.Component {
236 )
236 )
237 .then(txHash => {
237 .then(txHash => {
238 props.onSent(Just(Ok(txHash)), state.stx.value);
238 props.onSent(Just(Ok(txHash)), state.stx.value);
239− props.history.pop();
240
239
241 let routeData = {};
240 let routeData = {};
242 if (props.networkSeed) {
241 if (props.networkSeed) {
243 props.setNetworkSeedCache(props.networkSeed);
242 props.setNetworkSeedCache(props.networkSeed);
244 routeData.promptKeyfile = true;
243 routeData.promptKeyfile = true;
245 }
244 }
245+
246− props.history.push(ROUTE_NAMES.SENT_TRANSACTION, routeData);
246+ props.history.popAndPush(ROUTE_NAMES.SENT_TRANSACTION, routeData);
247 })
247 })
248 .catch(err => {
248 .catch(err => {
249 this.setState({
249 this.setState({
src/bridge/store/history.js+1−1
@@ -25,7 +25,7 @@ function _useHistory(initialRoutes = []) {
25 peek: () => last(history),
25 peek: () => last(history),
26 size: history.length,
26 size: history.length,
27 includes: name => includes(history.map(r => r.name), name),
27 includes: name => includes(history.map(r => r.name), name),
28− data: () => last(history).data,
28+ data: last(history).data,
29 };
29 };
30
30
31 // Scroll to top of page with each route transition.
31 // Scroll to top of page with each route transition.
src/bridge/views/SentTransaction.js+2−2
@@ -114,7 +114,7 @@ const SentTransaction = props => {
114 const { txnHashCursor, networkType, txnConfirmations } = props;
114 const { txnHashCursor, networkType, txnConfirmations } = props;
115 const { setPointCursor, pointCursor } = props;
115 const { setPointCursor, pointCursor } = props;
116
116
117− const promptKeyfile = history.data() && history.data().promptKeyfile;
117+ const promptKeyfile = history.data && history.data.promptKeyfile;
118
118
119 const w3 = need.web3(props);
119 const w3 = need.web3(props);
120
120
@@ -143,7 +143,7 @@ const SentTransaction = props => {
143 prop-type={'link'}
143 prop-type={'link'}
144 onClick={() => {
144 onClick={() => {
145 setPointCursor(pointCursor);
145 setPointCursor(pointCursor);
146− history.pop(2);
146+ history.pop();
147 }}>
147 }}>
148 {'Ok →'}
148 {'Ok →'}
149 </Button>
149 </Button>