Skip to content

Commit

Permalink
fix: global modal not showing sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabadesso committed Dec 23, 2024
1 parent dc15386 commit 3909e12
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 0 additions & 4 deletions config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ module.exports = function override(config, env) {
process: 'process/browser',
Buffer: ['buffer-shim', 'default']
}),
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env),
'global': 'window'
})
];

return config;
Expand Down
9 changes: 5 additions & 4 deletions patches/elliptic++bn.js+4.12.0.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
diff --git a/node_modules/elliptic/node_modules/bn.js/lib/bn.js b/node_modules/elliptic/node_modules/bn.js/lib/bn.js
index 3a4371e..629ed9c 100644
--- a/node_modules/elliptic/node_modules/bn.js/lib/bn.js
+++ b/node_modules/elliptic/node_modules/bn.js/lib/bn.js
@@ -48,12 +48,14 @@
@@ -48,14 +48,16 @@
BN.BN = BN;
BN.wordSize = 26;

Expand All @@ -13,16 +12,18 @@ index 3a4371e..629ed9c 100644
- Buffer = window.Buffer;
- } else {
- Buffer = require('buffer').Buffer;
- }
+ var customBuffer = require('../../../../../src/buffer-shim');
+ BNBuffer = customBuffer.Buffer || customBuffer.default;
+ } catch (e) {
} catch (e) {
+ try {
+ BNBuffer = require('buffer/').Buffer;
+ } catch (e2) {
+ BNBuffer = null;
}
+ }
}

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

Expand Down
12 changes: 7 additions & 5 deletions src/components/GlobalModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ export const GlobalModal = ({ children }) => {
}
};

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

/**
* Helper method to handle the modal's DOM lifecycle: showing the modal and
Expand Down

0 comments on commit 3909e12

Please sign in to comment.