Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
grab tab right before use
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayla Fitzsimmons authored and Kayla Fitzsimmons committed Aug 23, 2024
1 parent b92ddd9 commit 7a699c8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/mocksi-lite-next/src/pages/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,11 @@ chrome.runtime.onMessageExternal.addListener(
async (request, _sender, sendResponse) => {
console.log("Received message from external:", request);

// grab the url for the site the iframe is mounted in
const tab = await getCurrentTab();

if (request.message === "UNAUTHORIZED") {
const auth = await getAuth();
if (auth) {
const { accessToken, email } = auth;
const tab = await getCurrentTab();
sendResponse({
// pass the url where the extension is mounted so
// we can filter recordings by domain on the server
Expand All @@ -108,6 +106,7 @@ chrome.runtime.onMessageExternal.addListener(
});
}
} else {
const tab = await getCurrentTab();
if (tab?.id) {
chrome.tabs.sendMessage(tab?.id, {
data: request.data,
Expand Down

0 comments on commit 7a699c8

Please sign in to comment.