Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/docs/spec/supabase_js_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6571,7 +6571,7 @@ functions:
code: |
```ts
const { data, error } = await supabase
.from('countries')
.from('characters')
.select('name')
.range(0, 1)
```
Expand Down
17 changes: 9 additions & 8 deletions apps/studio/components/interfaces/Auth/AuditLogsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ export const AuditLogsForm = () => {
render={({ field }) => (
<FormItemLayout
layout="flex-row-reverse"
label="Disable writing auth audit logs to project database"
label="Write audit logs to the database"
description={
<p className="text-sm prose text-foreground-lighter max-w-full">
Audit logs will no longer be stored in the{' '}
When enabled, audit logs are written to the{' '}
<InlineLink
target="_blank"
rel="noopener noreferrer"
Expand All @@ -132,21 +132,22 @@ export const AuditLogsForm = () => {
{AUDIT_LOG_ENTRIES_TABLE}
</code>
</InlineLink>{' '}
table in your project's database, which will reduce database storage
usage. Audit logs will subsequently still be available in the{' '}
table.
<br />
You can disable this to reduce disk usage while still accessing logs
through the{' '}
<InlineLink
href={`/project/${projectRef}/logs/explorer?q=select%0A++cast(timestamp+as+datetime)+as+timestamp%2C%0A++event_message%2C+metadata+%0Afrom+auth_audit_logs+%0Alimit+10%0A`}
>
auth logs
Auth logs.
</InlineLink>
.
</p>
}
>
<FormControl_Shadcn_>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
checked={!field.value}
onCheckedChange={(value) => field.onChange(!value)}
disabled={!canUpdateConfig}
/>
</FormControl_Shadcn_>
Expand Down
5 changes: 3 additions & 2 deletions apps/studio/data/entitlements/entitlements-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -31,10 +32,10 @@ export const useEntitlementsQuery = <TData = EntitlementsData>(
{ enabled = true, ...options }: UseQueryOptions<EntitlementsData, EntitlementsError, TData> = {}
) => {
return useQuery<EntitlementsData, EntitlementsError, TData>({
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,
})
}
1 change: 1 addition & 0 deletions apps/studio/data/organizations/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 23 additions & 1 deletion packages/common/gotrue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,32 @@ async function debuggableNavigatorLock<R>(
}

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)

Expand Down
Loading