Skip to content

Commit

Permalink
v12.8.1: fix onbeforeunload
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Feb 26, 2024
1 parent 474f927 commit 3ebf270
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 66 deletions.
2 changes: 1 addition & 1 deletion dist/esm/index.bundle.js

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4758,7 +4758,7 @@ var ClosableContext = /*#__PURE__*/React.createContext();
var UpdatableContext = /*#__PURE__*/React.createContext();

var ClosableProvider = (function (props) {
var _useState = useState(true),
var _useState = useState(props.closable || true),
_useState2 = _slicedToArray(_useState, 2),
closable = _useState2[0],
setClosable = _useState2[1];
Expand Down Expand Up @@ -4808,14 +4808,9 @@ var ClosableProvider = (function (props) {
}
};

setTimeout(function () {
window.addEventListener('beforeunload', preventReload);
}, 800); // timeout to prevent beforeunload error in case browser redirects to wallet (e.g. Solana Mobile Wallet Adapter)

window.addEventListener('beforeunload', preventReload);
return function () {
setTimeout(function () {
window.removeEventListener('beforeunload', preventReload);
}, 800);
window.removeEventListener('beforeunload', preventReload);
};
}, [closable, props.closable]);
return /*#__PURE__*/React.createElement(ClosableContext.Provider, {
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.evm.js.map

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4760,7 +4760,7 @@ var ClosableContext = /*#__PURE__*/React.createContext();
var UpdatableContext = /*#__PURE__*/React.createContext();

var ClosableProvider = (function (props) {
var _useState = useState(true),
var _useState = useState(props.closable || true),
_useState2 = _slicedToArray(_useState, 2),
closable = _useState2[0],
setClosable = _useState2[1];
Expand Down Expand Up @@ -4810,14 +4810,9 @@ var ClosableProvider = (function (props) {
}
};

setTimeout(function () {
window.addEventListener('beforeunload', preventReload);
}, 800); // timeout to prevent beforeunload error in case browser redirects to wallet (e.g. Solana Mobile Wallet Adapter)

window.addEventListener('beforeunload', preventReload);
return function () {
setTimeout(function () {
window.removeEventListener('beforeunload', preventReload);
}, 800);
window.removeEventListener('beforeunload', preventReload);
};
}, [closable, props.closable]);
return /*#__PURE__*/React.createElement(ClosableContext.Provider, {
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.js.map

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions dist/esm/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -4759,7 +4759,7 @@ var ClosableContext = /*#__PURE__*/React.createContext();
var UpdatableContext = /*#__PURE__*/React.createContext();

var ClosableProvider = (function (props) {
var _useState = useState(true),
var _useState = useState(props.closable || true),
_useState2 = _slicedToArray(_useState, 2),
closable = _useState2[0],
setClosable = _useState2[1];
Expand Down Expand Up @@ -4809,14 +4809,9 @@ var ClosableProvider = (function (props) {
}
};

setTimeout(function () {
window.addEventListener('beforeunload', preventReload);
}, 800); // timeout to prevent beforeunload error in case browser redirects to wallet (e.g. Solana Mobile Wallet Adapter)

window.addEventListener('beforeunload', preventReload);
return function () {
setTimeout(function () {
window.removeEventListener('beforeunload', preventReload);
}, 800);
window.removeEventListener('beforeunload', preventReload);
};
}, [closable, props.closable]);
return /*#__PURE__*/React.createElement(ClosableContext.Provider, {
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.solana.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/umd/index.bundle.js

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions dist/umd/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4756,7 +4756,7 @@
var UpdatableContext = /*#__PURE__*/React__default['default'].createContext();

var ClosableProvider = (function (props) {
var _useState = React.useState(true),
var _useState = React.useState(props.closable || true),
_useState2 = _slicedToArray(_useState, 2),
closable = _useState2[0],
setClosable = _useState2[1];
Expand Down Expand Up @@ -4806,14 +4806,9 @@
}
};

setTimeout(function () {
window.addEventListener('beforeunload', preventReload);
}, 800); // timeout to prevent beforeunload error in case browser redirects to wallet (e.g. Solana Mobile Wallet Adapter)

window.addEventListener('beforeunload', preventReload);
return function () {
setTimeout(function () {
window.removeEventListener('beforeunload', preventReload);
}, 800);
window.removeEventListener('beforeunload', preventReload);
};
}, [closable, props.closable]);
return /*#__PURE__*/React__default['default'].createElement(ClosableContext.Provider, {
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.evm.js.map

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4756,7 +4756,7 @@
var UpdatableContext = /*#__PURE__*/React__default['default'].createContext();

var ClosableProvider = (function (props) {
var _useState = React.useState(true),
var _useState = React.useState(props.closable || true),
_useState2 = _slicedToArray(_useState, 2),
closable = _useState2[0],
setClosable = _useState2[1];
Expand Down Expand Up @@ -4806,14 +4806,9 @@
}
};

setTimeout(function () {
window.addEventListener('beforeunload', preventReload);
}, 800); // timeout to prevent beforeunload error in case browser redirects to wallet (e.g. Solana Mobile Wallet Adapter)

window.addEventListener('beforeunload', preventReload);
return function () {
setTimeout(function () {
window.removeEventListener('beforeunload', preventReload);
}, 800);
window.removeEventListener('beforeunload', preventReload);
};
}, [closable, props.closable]);
return /*#__PURE__*/React__default['default'].createElement(ClosableContext.Provider, {
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.js.map

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions dist/umd/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -4757,7 +4757,7 @@
var UpdatableContext = /*#__PURE__*/React__default['default'].createContext();

var ClosableProvider = (function (props) {
var _useState = React.useState(true),
var _useState = React.useState(props.closable || true),
_useState2 = _slicedToArray(_useState, 2),
closable = _useState2[0],
setClosable = _useState2[1];
Expand Down Expand Up @@ -4807,14 +4807,9 @@
}
};

setTimeout(function () {
window.addEventListener('beforeunload', preventReload);
}, 800); // timeout to prevent beforeunload error in case browser redirects to wallet (e.g. Solana Mobile Wallet Adapter)

window.addEventListener('beforeunload', preventReload);
return function () {
setTimeout(function () {
window.removeEventListener('beforeunload', preventReload);
}, 800);
window.removeEventListener('beforeunload', preventReload);
};
}, [closable, props.closable]);
return /*#__PURE__*/React__default['default'].createElement(ClosableContext.Provider, {
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.solana.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/widgets-evm",
"moduleName": "DePayWidgets",
"version": "12.8.0",
"version": "12.8.1",
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/widgets",
"moduleName": "DePayWidgets",
"version": "12.8.0",
"version": "12.8.1",
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion package.solana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/widgets-solana",
"moduleName": "DePayWidgets",
"version": "12.8.0",
"version": "12.8.1",
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand Down
10 changes: 3 additions & 7 deletions src/providers/ClosableProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UpdatableContext from '../contexts/UpdatableContext'

export default (props)=>{

const [closable, setClosable] = useState(true)
const [closable, setClosable] = useState(props.closable || true)
const [open, setOpen] = useState(true)
const { setUpdatable } = useContext(UpdatableContext)

Expand Down Expand Up @@ -36,13 +36,9 @@ export default (props)=>{
return msg
}
}
setTimeout(()=>{
window.addEventListener('beforeunload', preventReload);
}, 800) // timeout to prevent beforeunload error in case browser redirects to wallet (e.g. Solana Mobile Wallet Adapter)
window.addEventListener('beforeunload', preventReload);
return ()=>{
setTimeout(()=>{
window.removeEventListener('beforeunload', preventReload);
}, 800)
window.removeEventListener('beforeunload', preventReload);
}
}, [closable, props.closable])

Expand Down

0 comments on commit 3ebf270

Please sign in to comment.