Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: Add another lint rule for accessing user metadata in RLS (#22904)

Ivan Vasilov1edaf9ed0ca3
diff --git a/apps/studio/components/interfaces/Linter/LintPageTabs.tsx b/apps/studio/components/interfaces/Linter/LintPageTabs.tsx
index ae42b11687e..6a7d17602c0 100644
--- a/apps/studio/components/interfaces/Linter/LintPageTabs.tsx
+++ b/apps/studio/components/interfaces/Linter/LintPageTabs.tsx
@@ -13,15 +13,14 @@ import {
} from 'ui'
import { LINTER_LEVELS, LINT_TABS } from 'components/interfaces/Linter/Linter.constants'
+import ShimmeringLoader from 'components/ui/ShimmeringLoader'
import { Lint } from 'data/lint/lint-query'
import { useRouter } from 'next/router'
-import { lintCountLabel } from './Linter.utils'
interface LintPageTabsProps {
currentTab: string
setCurrentTab: (value: LINTER_LEVELS) => void
setSelectedLint: (value: Lint | null) => void
- setSelectedRow: (value: number | undefined) => void
isLoading: boolean
activeLints: Lint[]
}
@@ -29,7 +28,6 @@ const LintPageTabs = ({
currentTab,
setCurrentTab,
setSelectedLint,
- setSelectedRow,
isLoading,
activeLints,
}: LintPageTabsProps) => {
@@ -40,22 +38,32 @@ const LintPageTabs = ({
const infoLintsCount = activeLints.filter((x) => x.level === 'INFO').length
const LintCountLabel = ({ tab }: { tab: (typeof LINT_TABS)[number] }) => {
- const getCountLabel = () => {
- switch (tab.id) {
- case LINTER_LEVELS.ERROR:
- return lintCountLabel(isLoading, errorLintsCount, 'errors')
- case LINTER_LEVELS.WARN:
- return lintCountLabel(isLoading, warnLintsCount, 'warnings')
- case LINTER_LEVELS.INFO:
- return lintCountLabel(isLoading, infoLintsCount, 'suggestions')
- default:
- return null
- }
+ let count = 0
+ let label = ''
+ if (tab.id === LINTER_LEVELS.ERROR) {
+ count = errorLintsCount
+ label = 'errors'
+ }
+
+ if (tab.id === LINTER_LEVELS.WARN) {
+ count = warnLintsCount
+ label = 'warnings'
+ }
+
+ if (tab.id === LINTER_LEVELS.INFO) {
+ count = infoLintsCount
+ label = 'suggestions'
}
return (
<span className="text-xs text-foreground-muted group-hover:text-foreground-lighter group-data-[state=active]:text-foreground-lighter transition">
- {getCountLabel()}
+ {isLoading ? (
+ <ShimmeringLoader className="w-20 pt-1" />
+ ) : (
+ <>
+ {count} {label}
+ </>
+ )}
</span>
)
}
@@ -66,7 +74,6 @@ const LintPageTabs = ({
onValueChange={(value) => {
setCurrentTab(value as LINTER_LEVELS)
setSelectedLint(null)
- setSelectedRow(undefined)
const { sort, search, ...rest } = router.query
router.push({ ...router, query: { ...rest, preset: value } })
}}
diff --git a/apps/studio/components/interfaces/Linter/Linter.utils.tsx b/apps/studio/components/interfaces/Linter/Linter.utils.tsx
index bc75e8d0074..14778af87fe 100644
--- a/apps/studio/components/interfaces/Linter/Linter.utils.tsx
+++ b/apps/studio/components/interfaces/Linter/Linter.utils.tsx
@@ -1,10 +1,9 @@
-import { Box, Clock, Eye, Lock, Ruler, Table2, TextSearch, Unlock } from 'lucide-react'
+import { Box, Clock, Eye, Lock, Ruler, Table2, TextSearch, Unlock, User } from 'lucide-react'
import Link from 'next/link'
import { LINTER_LEVELS, LintInfo } from 'components/interfaces/Linter/Linter.constants'
import { LINT_TYPES, Lint } from 'data/lint/lint-query'
import { Badge, Button } from 'ui'
-import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'
export const lintInfoMap: LintInfo[] = [
{
@@ -150,6 +149,15 @@ export const lintInfoMap: LintInfo[] = [
linkText: 'View settings',
docsLink: 'https://supabase.com/docs/guides/platform/going-into-prod#security',
},
+ {
+ name: 'rls_references_user_metadata',
+ title: 'RLS references user metadata',
+ icon: <User className="text-foreground-muted" size={15} strokeWidth={1} />,
+ link: ({ projectRef }) => `/project/${projectRef}/auth/policies`,
+ linkText: 'View policies',
+ docsLink:
+ 'https://supabase.com/docs/guides/database/database-linter?queryGroups=lint&lint=0015_rls_references_user_metadata',
+ },
]
export const LintCTA = ({
@@ -179,7 +187,7 @@ export const LintCTA = ({
)
}
-export const entityTypeIcon = (type: string) => {
+export const EntityTypeIcon = ({ type }: { type: string | undefined }) => {
switch (type) {
case 'table':
return <Table2 className="text-foreground-muted" size={15} strokeWidth={1} />
@@ -192,7 +200,7 @@ export const entityTypeIcon = (type: string) => {
}
}
-export const lintEntity = (metadata: Lint['metadata']) => {
+export const LintEntity = ({ metadata }: { metadata: Lint['metadata'] }) => {
return (
(metadata &&
(metadata.entity ||
@@ -223,15 +231,3 @@ export const NoIssuesFound = ({ level }: { level: string }) => {
</div>
)
}
-
-export const lintCountLabel = (isLoading: boolean, count: number, label: string) => (
- <>
- {isLoading ? (
- <ShimmeringLoader className="w-20 pt-1" />
- ) : (
- <>
- {count} {label}
- </>
- )}
- </>
-)
diff --git a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
index 6616b9dd6e0..5f59baa25a6 100644
--- a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
+++ b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
@@ -1,4 +1,4 @@
-import { ExternalLink, Eye, Table2, X } from 'lucide-react'
+import { ExternalLink, X } from 'lucide-react'
import Link from 'next/link'
import { useRef, useState } from 'react'
import DataGrid, { Column, DataGridHandle, Row } from 'react-data-grid'
@@ -6,7 +6,7 @@ import ReactMarkdown from 'react-markdown'
import { useParams } from 'common'
import { LINTER_LEVELS } from 'components/interfaces/Linter/Linter.constants'
-import { NoIssuesFound, lintEntity, lintInfoMap } from 'components/interfaces/Linter/Linter.utils'
+import { LintEntity, NoIssuesFound, lintInfoMap } from 'components/interfaces/Linter/Linter.utils'
import { Lint } from 'data/lint/lint-query'
import {
Button,
@@ -20,13 +20,11 @@ import {
cn,
} from 'ui'
import { GenericSkeletonLoader } from 'ui-patterns'
-import { LintCTA, LintCategoryBadge, entityTypeIcon } from './Linter.utils'
+import { EntityTypeIcon, LintCTA, LintCategoryBadge } from './Linter.utils'
interface LinterDataGridProps {
isLoading: boolean
filteredLints: Lint[]
- selectedRow: number | undefined
- setSelectedRow: (value: number | undefined) => void
selectedLint: Lint | null
setSelectedLint: (value: Lint | null) => void
currentTab: LINTER_LEVELS
@@ -35,8 +33,6 @@ interface LinterDataGridProps {
const LinterDataGrid = ({
isLoading,
filteredLints,
- selectedRow,
- setSelectedRow,
selectedLint,
setSelectedLint,
currentTab,
@@ -68,8 +64,10 @@ const LinterDataGrid = ({
minWidth: 230,
value: (row: any) => (
<div className="flex items-center gap-1 text-xs">
- <span className="shrink-0">{entityTypeIcon(row.metadata?.type)}</span>
- {lintEntity(row.metadata)}
+ <span className="shrink-0">
+ <EntityTypeIcon type={row.metadata?.type} />
+ </span>
+ <LintEntity metadata={row.metadata} />
</div>
),
},
@@ -132,8 +130,8 @@ const LinterDataGrid = ({
headerRowHeight={36}
columns={columns}
rows={filteredLints ?? []}
- rowClass={(_, idx) => {
- const isSelected = idx === selectedRow
+ rowClass={(lint) => {
+ const isSelected = lint.cache_key === selectedLint?.cache_key
return [
`${isSelected ? 'bg-surface-300 dark:bg-surface-300' : 'bg-200'} cursor-pointer`,
`${isSelected ? '[&>div:first-child]:border-l-4 border-l-secondary [&>div]:border-l-foreground' : ''}`,
@@ -148,7 +146,6 @@ const LinterDataGrid = ({
{...props}
onClick={() => {
if (typeof idx === 'number' && idx >= 0) {
- setSelectedRow(idx)
setSelectedLint(props.row)
gridRef.current?.scrollToCell({ idx: 0, rowIdx: idx })
}
@@ -176,7 +173,6 @@ const LinterDataGrid = ({
icon={<X size={14} />}
onClick={() => {
setSelectedLint(null)
- setSelectedRow(undefined)
}}
/>
@@ -210,13 +206,8 @@ const LinterDataGrid = ({
<div className="flex items-center gap-2 text-sm mt-4">
<span>Entity</span>
<div className="flex items-center gap-1 px-2 py-0.5 bg-surface-200 border rounded-lg ">
- {selectedLint.metadata?.type === 'table' && (
- <Table2 className="text-foreground-muted" size={15} strokeWidth={1} />
- )}
- {selectedLint.metadata?.type === 'view' && (
- <Eye className="text-foreground-muted" size={15} strokeWidth={1.5} />
- )}{' '}
- {lintEntity(selectedLint.metadata)}
+ <EntityTypeIcon type={selectedLint.metadata?.type} />
+ <LintEntity metadata={selectedLint.metadata} />
</div>
</div>
diff --git a/apps/studio/components/interfaces/Linter/LinterFilters.tsx b/apps/studio/components/interfaces/Linter/LinterFilters.tsx
index e1c9dc73003..1fcab85e326 100644
--- a/apps/studio/components/interfaces/Linter/LinterFilters.tsx
+++ b/apps/studio/components/interfaces/Linter/LinterFilters.tsx
@@ -37,11 +37,11 @@ const LinterFilters = ({
<FilterPopover
name="Filter"
options={filterOptions}
- disabled={activeLints.filter((x) => x.level === currentTab).length === 0}
+ disabled={activeLints.filter((x) => x.level === tab.id).length === 0}
labelKey="name"
valueKey="value"
- activeOptions={filters.find((filter) => filter.level === currentTab)?.filters || []}
- onSaveFilters={(values) => updateFilters(currentTab, values)}
+ activeOptions={filters.find((filter) => filter.level === tab.id)?.filters || []}
+ onSaveFilters={(values) => updateFilters(tab.id, values)}
/>
</div>
))}
diff --git a/apps/studio/data/lint/lint-query.ts b/apps/studio/data/lint/lint-query.ts
index c3cda6ead36..938223f4b30 100644
--- a/apps/studio/data/lint/lint-query.ts
+++ b/apps/studio/data/lint/lint-query.ts
@@ -8,10 +8,11 @@ export const LINT_SQL = /* SQL */ `set local search_path = '';
(
with foreign_keys as (
select
- cl.relnamespace::regnamespace as schema_,
- cl.oid::regclass as table_,
+ cl.relnamespace::regnamespace::text as schema_name,
+ cl.relname as table_name,
+ cl.oid as table_oid,
ct.conname as fkey_name,
- ct.conkey col_attnums
+ ct.conkey as col_attnums
from
pg_catalog.pg_constraint ct
join pg_catalog.pg_class cl -- fkey owning table
@@ -28,12 +29,11 @@ with foreign_keys as (
),
index_ as (
select
- indrelid::regclass as table_,
- indrelid as table_oid,
+ pi.indrelid as table_oid,
indexrelid::regclass as index_,
string_to_array(indkey::text, ' ')::smallint[] as col_attnums
from
- pg_catalog.pg_index
+ pg_catalog.pg_index pi
where
indisvalid
)
@@ -45,35 +45,36 @@ select
'Identifies foreign key constraints without a covering index, which can impact database performance.' as description,
format(
'Table \`%s.%s\` has a foreign key \`%s\` without a covering index. This can lead to suboptimal query performance.',
- fk.schema_,
- fk.table_,
+ fk.schema_name,
+ fk.table_name,
fk.fkey_name
) as detail,
'https://supabase.com/docs/guides/database/database-linter?lint=0001_unindexed_foreign_keys' as remediation,
jsonb_build_object(
- 'schema', fk.schema_,
- 'name', fk.table_,
+ 'schema', fk.schema_name,
+ 'name', fk.table_name,
'type', 'table',
'fkey_name', fk.fkey_name,
'fkey_columns', fk.col_attnums
) as metadata,
- format('unindexed_foreign_keys_%s_%s_%s', fk.schema_, fk.table_, fk.fkey_name) as cache_key
+ format('unindexed_foreign_keys_%s_%s_%s', fk.schema_name, fk.table_name, fk.fkey_name) as cache_key
from
foreign_keys fk
left join index_ idx
- on fk.table_ = idx.table_
+ on fk.table_oid = idx.table_oid
and fk.col_attnums = idx.col_attnums
left join pg_catalog.pg_depend dep
on idx.table_oid = dep.objid
and dep.deptype = 'e'
where
idx.index_ is null
- and fk.schema_::text not in (
+ and fk.schema_name not in (
'_timescaledb_internal', 'auth', 'cron', 'extensions', 'graphql', 'graphql_public', 'information_schema', 'net', 'pgroonga', 'pgsodium', 'pgsodium_masks', 'pgtle', 'pgbouncer', 'pg_catalog', 'pgtle', 'realtime', 'repack', 'storage', 'supabase_functions', 'supabase_migrations', 'tiger', 'topology', 'vault'
)
and dep.objid is null -- exclude tables owned by extensions
order by
- fk.table_,
+ fk.schema_name,
+ fk.table_name,
fk.fkey_name)
union all
(
@@ -131,7 +132,7 @@ where
-- Standard View, accessible to anon or authenticated that is security_definer
(
c.relkind = 'v' -- v for view
- -- Exclude security invoker views
+ -- Exclude security invoker views
and not (
lower(coalesce(c.reloptions::text,'{}'))::text[]
&& array[
@@ -146,7 +147,7 @@ where
-- Standard View, security invoker, but no RLS enabled on auth.users
(
c.relkind in ('v') -- v for view
- -- is security invoker
+ -- is security invoker
and (
lower(coalesce(c.reloptions::text,'{}'))::text[]
&& array[
@@ -156,45 +157,18 @@ where
'security_invoker=on'
]
)
- and not pg_class_auth_users.relrowsecurity
+ and not pg_class_auth_users.relrowsecurity
)
)
group by
c.relname, c.oid)
union all
-(/*
-Usage of auth.uid(), auth.role() ... are common in RLS policies.
-
-A naive policy like
-
- create policy "rls_test_select" on test_table
- to authenticated
- using ( auth.uid() = user_id )
-
-will re-evaluate the auth.uid() function for every row. That can result in 100s of times slower performance
-https://supabase.com/docs/guides/database/postgres/row-level-security#call-functions-with-select
-
-To resolve that issue, the function calls can be wrapped like "(select auth.uid())" which causes the value to
-be executed exactly 1 time per query
-
-For example:
-
- create policy "rls_test_select" on test_table
- to authenticated
- using ( (select auth.uid()) = user_id )
-
-NOTE:
- This lint requires search_path = '' or 'auth' not in search_path
- because qual and with_check are dependent on search_path to determine if function calls include the "auth" schema
-*/
-
-
-
+(
with policies as (
select
- nsp.nspname as schema_,
- polrelid::regclass table_,
- pc.relrowsecurity is_rls_active,
+ nsp.nspname as schema_name,
+ pb.tablename as table_name,
+ pc.relrowsecurity as is_rls_active,
polname as policy_name,
polpermissive as is_permissive, -- if not, then restrictive
(select array_agg(r::regrole) from unnest(polroles) as x(r)) as roles,
@@ -225,22 +199,23 @@ select
array['PERFORMANCE'] as categories,
'Detects if calls to \`auth.<function>()\` in RLS policies are being unnecessarily re-evaluated for each row' as description,
format(
- 'Table \`%s\` has a row level security policy \`%s\` that re-evaluates an auth.<function>() for each row. This produces suboptimal query performance at scale. Resolve the issue by replacing \`auth.<function>()\` with \`(select auth.<function>())\`. See [docs](https://supabase.com/docs/guides/database/postgres/row-level-security#call-functions-with-select) for more info.',
- table_,
+ 'Table \`%s.%s\` has a row level security policy \`%s\` that re-evaluates an auth.<function>() for each row. This produces suboptimal query performance at scale. Resolve the issue by replacing \`auth.<function>()\` with \`(select auth.<function>())\`. See [docs](https://supabase.com/docs/guides/database/postgres/row-level-security#call-functions-with-select) for more info.',
+ schema_name,
+ table_name,
policy_name
) as detail,
'https://supabase.com/docs/guides/database/database-linter?lint=0003_auth_rls_initplan' as remediation,
jsonb_build_object(
- 'schema', schema_,
- 'name', table_,
+ 'schema', schema_name,
+ 'name', table_name,
'type', 'table'
) as metadata,
- format('auth_rls_init_plan_%s_%s_%s', schema_, table_, policy_name) as cache_key
+ format('auth_rls_init_plan_%s_%s_%s', schema_name, table_name, policy_name) as cache_key
from
policies
where
is_rls_active
- and schema_::text not in (
+ and schema_name not in (
'_timescaledb_internal', 'auth', 'cron', 'extensions', 'graphql', 'graphql_public', 'information_schema', 'net', 'pgroonga', 'pgsodium', 'pgsodium_masks', 'pgtle', 'pgbouncer', 'pg_catalog', 'pgtle', 'realtime', 'repack', 'storage', 'supabase_functions', 'supabase_migrations', 'tiger', 'topology', 'vault'
)
and (
@@ -678,7 +653,7 @@ where
and not c.relrowsecurity)
union all
(
-select
+select
'extension_in_public' as name,
'WARN' as level,
'EXTERNAL' as facing,
@@ -704,7 +679,61 @@ where
-- plpgsql is installed by default in public and outside user control
-- confirmed safe
pe.extname not in ('plpgsql')
- and pe.extnamespace::regnamespace::text = 'public')`.trim()
+ and pe.extnamespace::regnamespace::text = 'public')
+union all
+(
+with policies as (
+ select
+ nsp.nspname as schema_name,
+ pb.tablename as table_name,
+ polname as policy_name,
+ qual,
+ with_check
+ from
+ pg_catalog.pg_policy pa
+ join pg_catalog.pg_class pc
+ on pa.polrelid = pc.oid
+ join pg_catalog.pg_namespace nsp
+ on pc.relnamespace = nsp.oid
+ join pg_catalog.pg_policies pb
+ on pc.relname = pb.tablename
+ and nsp.nspname = pb.schemaname
+ and pa.polname = pb.policyname
+)
+select
+ 'rls_references_user_metadata' as name,
+ 'ERROR' as level,
+ 'EXTERNAL' as facing,
+ array['SECURITY'] as categories,
+ 'Detects when Supabase Auth user_metadata is referenced insecurely in a row level security (RLS) policy.' as description,
+ format(
+ 'Table \`%s.%s\` has a row level security policy \`%s\` that references Supabase Auth \`user_metadata\`. \`user_metadata\` is editable by end users and should never be used in a security context.',
+ schema_name,
+ table_name,
+ policy_name
+ ) as detail,
+ 'https://supabase.com/docs/guides/database/database-linter?lint=0015_rls_references_user_metadata' as remediation,
+ jsonb_build_object(
+ 'schema', schema_name,
+ 'name', table_name,
+ 'type', 'table'
+ ) as metadata,
+ format('rls_references_user_metadata_%s_%s_%s', schema_name, table_name, policy_name) as cache_key
+from
+ policies
+where
+ schema_name not in (
+ '_timescaledb_internal', 'auth', 'cron', 'extensions', 'graphql', 'graphql_public', 'information_schema', 'net', 'pgroonga', 'pgsodium', 'pgsodium_masks', 'pgtle', 'pgbouncer', 'pg_catalog', 'pgtle', 'realtime', 'repack', 'storage', 'supabase_functions', 'supabase_migrations', 'tiger', 'topology', 'vault'
+ )
+ and (
+ -- Example: auth.jwt() -> 'user_metadata'
+ -- False positives are possible, but it isn't practical to string match
+ -- If false positive rate is too high, this expression can iterate
+ qual like '%auth.jwt()%user_metadata%'
+ or qual like '%current_setting(%request.jwt.claims%)%user_metadata%'
+ or with_check like '%auth.jwt()%user_metadata%'
+ or with_check like '%current_setting(%request.jwt.claims%)%user_metadata%'
+ ))`.trim()
// Array of all lint rules we handle right now.
export const LINT_TYPES = [
@@ -723,6 +752,7 @@ export const LINT_TYPES = [
'extension_in_public',
'auth_otp_long_expiry',
'auth_otp_short_length',
+ 'rls_references_user_metadata',
] as const
export type LINT_TYPES = (typeof LINT_TYPES)[number]
@@ -739,7 +769,7 @@ export type Lint = {
schema?: string
name?: string
entity?: string
- type?: 'table' | 'view' | 'auth'
+ type?: 'table' | 'view' | 'auth' | 'function' | 'extension'
fkey_name?: string
fkey_columns?: number[]
} | null
diff --git a/apps/studio/pages/project/[ref]/database/performance-advisor.tsx b/apps/studio/pages/project/[ref]/database/performance-advisor.tsx
index c69b9c2d7c4..e8e1c8e5f85 100644
--- a/apps/studio/pages/project/[ref]/database/performance-advisor.tsx
+++ b/apps/studio/pages/project/[ref]/database/performance-advisor.tsx
@@ -1,18 +1,18 @@
-import { useState } from 'react'
import { useParams } from 'common'
import { lintInfoMap } from 'components/interfaces/Linter/Linter.utils'
import { DatabaseLayout } from 'components/layouts'
import { FormHeader } from 'components/ui/Forms'
import { Lint, useProjectLintsQuery } from 'data/lint/lint-query'
import { useSelectedProject } from 'hooks'
+import { useState } from 'react'
import type { NextPageWithLayout } from 'types'
import { LoadingLine } from 'ui'
import LintPageTabs from 'components/interfaces/Linter/LintPageTabs'
import { LINTER_LEVELS } from 'components/interfaces/Linter/Linter.constants'
import LinterDataGrid from 'components/interfaces/Linter/LinterDataGrid'
-import LinterPageFooter from 'components/interfaces/Linter/LinterPageFooter'
import LinterFilters from 'components/interfaces/Linter/LinterFilters'
+import LinterPageFooter from 'components/interfaces/Linter/LinterPageFooter'
const ProjectLints: NextPageWithLayout = () => {
const project = useSelectedProject()
@@ -28,7 +28,6 @@ const ProjectLints: NextPageWithLayout = () => {
const [currentTab, setCurrentTab] = useState<LINTER_LEVELS>(
(preset as LINTER_LEVELS) ?? LINTER_LEVELS.ERROR
)
- const [selectedRow, setSelectedRow] = useState<number>()
const [selectedLint, setSelectedLint] = useState<Lint | null>(null)
const { data, isLoading, isRefetching, refetch } = useProjectLintsQuery({
@@ -68,7 +67,6 @@ const ProjectLints: NextPageWithLayout = () => {
currentTab={currentTab}
setCurrentTab={setCurrentTab}
setSelectedLint={setSelectedLint}
- setSelectedRow={setSelectedRow}
/>
<LinterFilters
filterOptions={filterOptions}
@@ -81,8 +79,6 @@ const ProjectLints: NextPageWithLayout = () => {
<LinterDataGrid
filteredLints={filteredLints}
currentTab={currentTab}
- selectedRow={selectedRow}
- setSelectedRow={setSelectedRow}
selectedLint={selectedLint}
setSelectedLint={setSelectedLint}
isLoading={isLoading}
diff --git a/apps/studio/pages/project/[ref]/database/security-advisor.tsx b/apps/studio/pages/project/[ref]/database/security-advisor.tsx
index 50fc6642ddf..d6ef70b6c49 100644
--- a/apps/studio/pages/project/[ref]/database/security-advisor.tsx
+++ b/apps/studio/pages/project/[ref]/database/security-advisor.tsx
@@ -29,12 +29,11 @@ const ProjectLints: NextPageWithLayout = () => {
const [currentTab, setCurrentTab] = useState<LINTER_LEVELS>(
(preset as LINTER_LEVELS) ?? LINTER_LEVELS.ERROR
)
- const [selectedRow, setSelectedRow] = useState<number>()
const [selectedLint, setSelectedLint] = useState<Lint | null>(null)
const {
data,
- isLoading,
+ isLoading: areLintsLoading,
isRefetching,
refetch: refetchLintsQuery,
} = useProjectLintsQuery({
@@ -42,10 +41,16 @@ const ProjectLints: NextPageWithLayout = () => {
connectionString: project?.connectionString,
})
- const { data: authConfig, refetch: refetchAuthConfigQuery } = useAuthConfigQuery({
+ const {
+ data: authConfig,
+ isLoading: isAuthConfigLoading,
+ refetch: refetchAuthConfigQuery,
+ } = useAuthConfigQuery({
projectRef: project?.ref,
})
+ const isLoading = areLintsLoading || isAuthConfigLoading
+
const refetch = () => {
refetchLintsQuery()
refetchAuthConfigQuery()
@@ -125,7 +130,6 @@ const ProjectLints: NextPageWithLayout = () => {
currentTab={currentTab}
setCurrentTab={setCurrentTab}
setSelectedLint={setSelectedLint}
- setSelectedRow={setSelectedRow}
/>
<LinterFilters
filterOptions={filterOptions}
@@ -138,8 +142,6 @@ const ProjectLints: NextPageWithLayout = () => {
<LinterDataGrid
filteredLints={filteredLints}
currentTab={currentTab}
- selectedRow={selectedRow}
- setSelectedRow={setSelectedRow}
selectedLint={selectedLint}
setSelectedLint={setSelectedLint}
isLoading={isLoading}