Skip to content

Commit 8066330

Browse files
authored
Merge pull request #33 from VapiAI/steven-diaz/vap-9999-remove-tab-id-logic
chore: remove tab id restriction
2 parents 0a07e2f + 2631e3a commit 8066330

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

src/utils/vapiCallStorage.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,10 @@ export interface StoredCallData {
1313
};
1414
callOptions?: any;
1515
timestamp: number;
16-
tabId?: string;
1716
}
1817

1918
export type StorageType = 'session' | 'cookies';
2019

21-
// Generate or retrieve tab-specific ID (stored in sessionStorage)
22-
function getTabId(): string {
23-
const TAB_ID_KEY = '_vapi_tab_id';
24-
let tabId = sessionStorage.getItem(TAB_ID_KEY);
25-
26-
if (!tabId) {
27-
tabId = `tab_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
28-
sessionStorage.setItem(TAB_ID_KEY, tabId);
29-
}
30-
31-
return tabId;
32-
}
33-
3420
// Get root domain for cookie (e.g., ".domain.com")
3521
function getRootDomain(): string {
3622
const hostname = window.location.hostname;
@@ -83,13 +69,10 @@ export const storeCallData = (
8369
if (storageType === 'session') {
8470
sessionStorage.setItem(reconnectStorageKey, JSON.stringify(webCallToStore));
8571
} else if (storageType === 'cookies') {
86-
const tabId = getTabId();
87-
const webCallToStoreWithTab = { ...webCallToStore, tabId };
88-
8972
try {
9073
const rootDomain = getRootDomain();
9174

92-
Cookies.set(reconnectStorageKey, JSON.stringify(webCallToStoreWithTab), {
75+
Cookies.set(reconnectStorageKey, JSON.stringify(webCallToStore), {
9376
domain: rootDomain,
9477
path: '/',
9578
secure: true,
@@ -113,20 +96,11 @@ export const getStoredCallData = (
11396

11497
return JSON.parse(sessionData);
11598
} else if (storageType === 'cookies') {
116-
const currentTabId = getTabId();
11799
const cookieValue = Cookies.get(reconnectStorageKey);
118100

119101
if (!cookieValue) return null;
120102

121-
const data = JSON.parse(cookieValue);
122-
123-
// Verify tab ID matches (prevents multi-tab reconnection)
124-
if (data.tabId !== currentTabId) {
125-
console.warn('Tab ID mismatch - ignoring call data from different tab');
126-
return null;
127-
}
128-
129-
return data;
103+
return JSON.parse(cookieValue);
130104
}
131105

132106
return null;

0 commit comments

Comments
 (0)