delay window close by 200 ms

This commit is contained in:
Fidel Coria
2020-12-22 16:03:21 -06:00
parent 0836691020
commit 29b4056f2c
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/core-api': patch
---
Remove race condition in loginPopup
Delay auth loginPopup close to avoid race condition with callers of authFlowHelpers.
@@ -56,7 +56,9 @@ export const postMessageResponse = (
var originInfo = {'type': 'config_info', 'targetOrigin': origin};
(window.opener || window.parent).postMessage(originInfo, '*');
(window.opener || window.parent).postMessage(JSON.parse(authResponse), origin);
window.close();
setTimeout(() => {
window.close();
}, 100 * 2); // double the interval of the core-api lib/loginPopup.ts
`;
const hash = crypto.createHash('sha256').update(script).digest('base64');