diff --git a/src/equicordplugins/timezones/database.tsx b/src/equicordplugins/timezones/database.tsx index 45e13b58..643f760b 100644 --- a/src/equicordplugins/timezones/database.tsx +++ b/src/equicordplugins/timezones/database.tsx @@ -26,11 +26,11 @@ export async function setUserDatabaseTimezone(userId: string, timezone: string | await DataStore.set(DATASTORE_KEY, databaseTimezones); } -export async function getTimezone(userId: string): Promise { +export async function getTimezone(userId: string, force?: boolean): Promise { const now = Date.now(); const cached = databaseTimezones[userId]; - if (cached && now < cached.expires) return cached.value; + if (cached && now < cached.expires && !force) return cached.value; if (!pendingRequests[userId]) { pendingRequests[userId] = (async () => { diff --git a/src/equicordplugins/timezones/index.tsx b/src/equicordplugins/timezones/index.tsx index 6597ea4a..7fca1b34 100644 --- a/src/equicordplugins/timezones/index.tsx +++ b/src/equicordplugins/timezones/index.tsx @@ -201,9 +201,7 @@ const userContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: { showToast("Refreshing timezone...", Toasts.Type.CLOCK); try { - const timezone = await getTimezone(user.id); - setUserDatabaseTimezone(user.id, timezone); - timezones[user.id] = timezone; + timezones[user.id] = await getTimezone(user.id, true); showToast("Timezone refreshed successfully!", Toasts.Type.SUCCESS); } catch (error) { console.error("Failed to refresh timezone:", error);