diff --git a/apps/docs/spec/supabase_js_v2.yml b/apps/docs/spec/supabase_js_v2.yml index 169464ae0fc3d..1e15bc95b8d81 100644 --- a/apps/docs/spec/supabase_js_v2.yml +++ b/apps/docs/spec/supabase_js_v2.yml @@ -6571,7 +6571,7 @@ functions: code: | ```ts const { data, error } = await supabase - .from('countries') + .from('characters') .select('name') .range(0, 1) ``` diff --git a/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx b/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx index 1630654eae40a..dab27c252cedc 100644 --- a/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx +++ b/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx @@ -119,10 +119,10 @@ export const AuditLogsForm = () => { render={({ field }) => ( - Audit logs will no longer be stored in the{' '} + When enabled, audit logs are written to the{' '} { {AUDIT_LOG_ENTRIES_TABLE} {' '} - table in your project's database, which will reduce database storage - usage. Audit logs will subsequently still be available in the{' '} + table. +
+ You can disable this to reduce disk usage while still accessing logs + through the{' '} - auth logs + Auth logs. - .

} > field.onChange(!value)} disabled={!canUpdateConfig} /> diff --git a/apps/studio/data/entitlements/entitlements-query.ts b/apps/studio/data/entitlements/entitlements-query.ts index c12b52f201e9b..c06df0e7dc920 100644 --- a/apps/studio/data/entitlements/entitlements-query.ts +++ b/apps/studio/data/entitlements/entitlements-query.ts @@ -2,6 +2,7 @@ import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { ResponseError } from 'types/base' import type { components } from 'api-types' +import { organizationKeys } from 'data/organizations/keys' export type EntitlementsVariables = { slug: string @@ -31,10 +32,10 @@ export const useEntitlementsQuery = ( { enabled = true, ...options }: UseQueryOptions = {} ) => { return useQuery({ - queryKey: ['entitlements', slug], + queryKey: [organizationKeys.entitlements(slug)], queryFn: ({ signal }) => getEntitlements({ slug }, signal), enabled: enabled && typeof slug !== 'undefined', ...options, - staleTime: 1 * 60 * 1000, + staleTime: 30 * 60 * 1000, }) } diff --git a/apps/studio/data/organizations/keys.ts b/apps/studio/data/organizations/keys.ts index 28fb5e039afaf..7e5be236f76d9 100644 --- a/apps/studio/data/organizations/keys.ts +++ b/apps/studio/data/organizations/keys.ts @@ -4,6 +4,7 @@ export const organizationKeys = { members: (slug?: string) => ['organizations', slug, 'members'] as const, mfa: (slug?: string) => ['organizations', slug, 'mfa'] as const, paymentMethods: (slug: string | undefined) => ['organizations', slug, 'payment-methods'] as const, + entitlements: (slug: string | undefined) => ['entitlements', slug] as const, roles: (slug: string | undefined) => ['organizations', slug, 'roles'] as const, freeProjectLimitCheck: (slug: string | undefined) => ['organizations', slug, 'free-project-limit-check'] as const, diff --git a/apps/studio/data/subscriptions/org-subscription-update-mutation.ts b/apps/studio/data/subscriptions/org-subscription-update-mutation.ts index e6bbace4b160c..273fded335efa 100644 --- a/apps/studio/data/subscriptions/org-subscription-update-mutation.ts +++ b/apps/studio/data/subscriptions/org-subscription-update-mutation.ts @@ -76,6 +76,7 @@ export const useOrgSubscriptionUpdateMutation = ({ queryClient.invalidateQueries(invoicesKeys.orgUpcomingPreview(slug)), queryClient.invalidateQueries(organizationKeys.detail(slug)), queryClient.invalidateQueries(organizationKeys.list()), + queryClient.invalidateQueries(organizationKeys.entitlements(slug)), ]) if (variables.paymentMethod) { diff --git a/packages/common/gotrue.ts b/packages/common/gotrue.ts index 0d1db5f69a20f..7a241cf4ce1ab 100644 --- a/packages/common/gotrue.ts +++ b/packages/common/gotrue.ts @@ -144,10 +144,32 @@ async function debuggableNavigatorLock( } console.error( - `Waited for over 10s to acquire an Auth client lock`, + `Waited for over 10s to acquire an Auth client lock, will steal the lock to unblock`, await navigator.locks.query(), stackException ) + + // quickly steal the lock and release it so that others can acquire it, + // while leaving the code that was holding it to continue running + navigator.locks + .request( + name, + { + steal: true, + }, + async () => { + await new Promise((accept) => { + setTimeout(accept, 0) + }) + + console.error('Lock was stolen and now released', stackException) + } + ) + .catch((e: any) => { + if (captureException) { + captureException(e) + } + }) })() }, 10000)