diff --git a/src/fb-stubs/GK.tsx b/src/fb-stubs/GK.tsx index 6cf2159ef..69c835360 100644 --- a/src/fb-stubs/GK.tsx +++ b/src/fb-stubs/GK.tsx @@ -29,4 +29,22 @@ export default class GK { static serializeGKs() { return ''; } + + static async withWhitelistedGK( + id: GKID, + callback: () => Promise | void, + ) { + whitelistedGKs.push(id); + try { + const p = callback(); + if (p) { + await p; + } + } finally { + const idx = whitelistedGKs.indexOf(id); + if (idx !== -1) { + whitelistedGKs.splice(idx, 1); + } + } + } }