Skip to content

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

fix: Bug with Project Selector in support form resets on windows focus (#39241)

Ivan Vasilovd6a2b32996f0
diff --git a/apps/studio/components/interfaces/Support/SupportFormV2.tsx b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
index 883f88881db..3d3871bf3d1 100644
--- a/apps/studio/components/interfaces/Support/SupportFormV2.tsx
+++ b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
@@ -467,6 +467,7 @@ export const SupportFormV2 = ({
<FormItemLayout hideMessage layout="vertical" label="Which project is affected?">
<FormControl_Shadcn_>
<OrganizationProjectSelector
+ key={organizationSlug}
sameWidthAsTrigger
checkPosition="left"
slug={organizationSlug}
diff --git a/apps/studio/components/ui/OrganizationProjectSelector.tsx b/apps/studio/components/ui/OrganizationProjectSelector.tsx
index 9105bf8e443..4af7ba75f57 100644
--- a/apps/studio/components/ui/OrganizationProjectSelector.tsx
+++ b/apps/studio/components/ui/OrganizationProjectSelector.tsx
@@ -113,11 +113,13 @@ export const OrganizationProjectSelector = ({
])
useEffect(() => {
- if (isSuccessProjects && !isFetching && !isFetchingNextPage && !!onInitialLoad) {
- onInitialLoad(projects)
+ // isLoadingProjects is true only during initial load. If the variables for the query change (slug), isLoadingProjects
+ // will be true again.
+ if (!isLoadingProjects && isSuccessProjects) {
+ onInitialLoad?.(projects)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isSuccessProjects, isFetching, isFetchingNextPage, slug])
+ }, [isLoadingProjects, isSuccessProjects])
return (
<Popover_Shadcn_ open={open} onOpenChange={setOpen} modal={false}>