on master help sign in
fix: correctly pop and then push routes within statelesstransaction
commit9aab1fe0a8e222fa123ba290dfe2ced891c0e9a9 authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateTue 11 Jun 2019, 12:48 (7 years ago) parent332575f
3 files changed+5−5
src/bridge/components/StatelessTransaction.js+2−2 src/bridge/store/history.js+1−1 src/bridge/views/SentTransaction.js+2−2
src/bridge/components/StatelessTransaction.js+2−2
@@ -236,14 +236,14 @@ class StatelessTransaction extends React.Component {
236236 )
237237 .then(txHash => {
238238 props.onSent(Just(Ok(txHash)), state.stx.value);
239− props.history.pop();
240239
241240 let routeData = {};
242241 if (props.networkSeed) {
243242 props.setNetworkSeedCache(props.networkSeed);
244243 routeData.promptKeyfile = true;
245244 }
246− props.history.push(ROUTE_NAMES.SENT_TRANSACTION, routeData);
245+
246+ props.history.popAndPush(ROUTE_NAMES.SENT_TRANSACTION, routeData);
247247 })
248248 .catch(err => {
249249 this.setState({
src/bridge/store/history.js+1−1
@@ -25,7 +25,7 @@ function _useHistory(initialRoutes = []) {
2525 peek: () => last(history),
2626 size: history.length,
2727 includes: name => includes(history.map(r => r.name), name),
28− data: () => last(history).data,
28+ data: last(history).data,
2929 };
3030
3131 // Scroll to top of page with each route transition.
src/bridge/views/SentTransaction.js+2−2
@@ -114,7 +114,7 @@ const SentTransaction = props => {
114114 const { txnHashCursor, networkType, txnConfirmations } = props;
115115 const { setPointCursor, pointCursor } = props;
116116
117− const promptKeyfile = history.data() && history.data().promptKeyfile;
117+ const promptKeyfile = history.data && history.data.promptKeyfile;
118118
119119 const w3 = need.web3(props);
120120
@@ -143,7 +143,7 @@ const SentTransaction = props => {
143143 prop-type={'link'}
144144 onClick={() => {
145145 setPointCursor(pointCursor);
146− history.pop(2);
146+ history.pop();
147147 }}>
148148 {'Ok →'}
149149 </Button>