Skip to content

Commit 741b288

Browse files
committed
fix: global modal not showing sometimes
1 parent dc15386 commit 741b288

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

patches/elliptic++bn.js+4.12.0.patch

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
diff --git a/node_modules/elliptic/node_modules/bn.js/lib/bn.js b/node_modules/elliptic/node_modules/bn.js/lib/bn.js
2-
index 3a4371e..629ed9c 100644
32
--- a/node_modules/elliptic/node_modules/bn.js/lib/bn.js
43
+++ b/node_modules/elliptic/node_modules/bn.js/lib/bn.js
5-
@@ -48,12 +48,14 @@
4+
@@ -48,14 +48,16 @@
65
BN.BN = BN;
76
BN.wordSize = 26;
87

@@ -13,16 +12,18 @@ index 3a4371e..629ed9c 100644
1312
- Buffer = window.Buffer;
1413
- } else {
1514
- Buffer = require('buffer').Buffer;
15+
- }
1616
+ var customBuffer = require('../../../../../src/buffer-shim');
1717
+ BNBuffer = customBuffer.Buffer || customBuffer.default;
18-
+ } catch (e) {
18+
} catch (e) {
1919
+ try {
2020
+ BNBuffer = require('buffer/').Buffer;
2121
+ } catch (e2) {
2222
+ BNBuffer = null;
23-
}
23+
+ }
2424
}
2525

26+
BN.isBN = function isBN (num) {
2627
@@ -526,8 +528,8 @@
2728
};
2829

src/components/GlobalModal.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@ export const GlobalModal = ({ children }) => {
124124
}
125125
};
126126

127-
const showModal = (modalType, modalProps = {}) => {
128-
console.log('Will show modal (global).');
127+
/* Without this setTimeout, calling showModal right after hiding an existing
128+
* modal will not display the backdrop due to a race condition. setTimeout
129+
* sends this method to the end of the event loop, making sure that it is
130+
* executed after the previous jquery calls
131+
*/
132+
const showModal = (modalType, modalProps = {}) => setTimeout(() => {
129133
setStore({
130134
...store,
131135
modalType,
@@ -135,10 +139,8 @@ export const GlobalModal = ({ children }) => {
135139
// Sometimes the modal backdrop won't show up again after being
136140
// removed forcefully by the hideModal, so we should just show it
137141
// again.
138-
const modal = $('.modal-backdrop');
139-
console.log('modal:', modal);
140142
$('.modal-backdrop').fadeIn(150);
141-
};
143+
}, 0);
142144

143145
/**
144146
* Helper method to handle the modal's DOM lifecycle: showing the modal and

0 commit comments

Comments
 (0)