Skip to content

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

fix: cron integration form (#44181)

Vaibhav1604baaca5d9
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/SqlFunctionSection.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/SqlFunctionSection.tsx
index 41777b56e3c..d19a394bc22 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/SqlFunctionSection.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/SqlFunctionSection.tsx
@@ -1,9 +1,9 @@
-import { UseFormReturn } from 'react-hook-form'
-
import FunctionSelector from 'components/ui/FunctionSelector'
import SchemaSelector from 'components/ui/SchemaSelector'
+import { UseFormReturn } from 'react-hook-form'
import { FormField_Shadcn_, SheetSection } from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
+
import { CreateCronJobForm } from './CreateCronJobSheet/CreateCronJobSheet.constants'
interface SqlFunctionSectionProps {
@@ -24,6 +24,7 @@ export const SqlFunctionSection = ({ form }: SqlFunctionSectionProps) => {
size="small"
className="w-56 2xl:w-full"
selectedSchemaName={field.value}
+ stopScrollPropagation
onSelectSchema={(name) => {
field.onChange(name)
// deselect the selected function when the schema is changed
@@ -44,6 +45,7 @@ export const SqlFunctionSection = ({ form }: SqlFunctionSectionProps) => {
className="w-56 2xl:w-full"
schema={schema}
value={field.value}
+ stopScrollPropagation
onChange={(name) => field.onChange(name)}
/>
</FormItemLayout>
diff --git a/apps/studio/components/ui/FunctionSelector.tsx b/apps/studio/components/ui/FunctionSelector.tsx
index 70c4c74f3fb..80838d4d253 100644
--- a/apps/studio/components/ui/FunctionSelector.tsx
+++ b/apps/studio/components/ui/FunctionSelector.tsx
@@ -1,30 +1,29 @@
-import { uniqBy } from 'lodash'
-import { Check, ChevronsUpDown, Plus } from 'lucide-react'
-import { useState } from 'react'
-
import { useParams } from 'common'
import {
DatabaseFunctionsData,
useDatabaseFunctionsQuery,
} from 'data/database-functions/database-functions-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
+import { uniqBy } from 'lodash'
+import { Check, ChevronsUpDown, Plus } from 'lucide-react'
import Link from 'next/link'
import { useRouter } from 'next/router'
+import { useState } from 'react'
import {
+ Alert_Shadcn_,
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
- Alert_Shadcn_,
Button,
+ Command_Shadcn_,
CommandEmpty_Shadcn_,
CommandGroup_Shadcn_,
CommandInput_Shadcn_,
CommandItem_Shadcn_,
CommandList_Shadcn_,
CommandSeparator_Shadcn_,
- Command_Shadcn_,
+ Popover_Shadcn_,
PopoverContent_Shadcn_,
PopoverTrigger_Shadcn_,
- Popover_Shadcn_,
ScrollArea,
} from 'ui'
@@ -38,6 +37,7 @@ interface FunctionSelectorProps {
value: string
onChange: (value: string) => void
disabled?: boolean
+ stopScrollPropagation?: boolean
// used to filter the functions by a criteria
filterFunction?: (func: DatabaseFunction) => boolean
noResultsLabel?: React.ReactNode
@@ -51,6 +51,7 @@ const FunctionSelector = ({
schema,
value,
onChange,
+ stopScrollPropagation = false,
filterFunction = () => true,
noResultsLabel = <span>No functions found in this schema.</span>,
}: FunctionSelectorProps) => {
@@ -127,7 +128,9 @@ const FunctionSelector = ({
<PopoverContent_Shadcn_ className="p-0" side="bottom" align="start" sameWidthAsTrigger>
<Command_Shadcn_>
<CommandInput_Shadcn_ placeholder="Search functions..." />
- <CommandList_Shadcn_>
+ <CommandList_Shadcn_
+ onWheel={stopScrollPropagation ? (event) => event.stopPropagation() : undefined}
+ >
<CommandEmpty_Shadcn_>No functions found</CommandEmpty_Shadcn_>
<CommandGroup_Shadcn_>
<ScrollArea className={(functions || []).length > 7 ? 'h-[210px]' : ''}>
diff --git a/apps/studio/components/ui/SchemaSelector.tsx b/apps/studio/components/ui/SchemaSelector.tsx
index 0859b4f5dc8..d934529a2e7 100644
--- a/apps/studio/components/ui/SchemaSelector.tsx
+++ b/apps/studio/components/ui/SchemaSelector.tsx
@@ -32,6 +32,7 @@ interface SchemaSelectorProps {
placeholderLabel?: string
supportSelectAll?: boolean
excludedSchemas?: string[]
+ stopScrollPropagation?: boolean
onSelectSchema: (name: string) => void
onSelectCreateSchema?: () => void
align?: 'start' | 'end'
@@ -46,6 +47,7 @@ export const SchemaSelector = ({
placeholderLabel = 'Choose a schema...',
supportSelectAll = false,
excludedSchemas = [],
+ stopScrollPropagation = false,
onSelectSchema,
onSelectCreateSchema,
align = 'start',
@@ -136,7 +138,9 @@ export const SchemaSelector = ({
>
<Command_Shadcn_>
<CommandInput_Shadcn_ className="text-xs" placeholder="Find schema..." />
- <CommandList_Shadcn_>
+ <CommandList_Shadcn_
+ onWheel={stopScrollPropagation ? (event) => event.stopPropagation() : undefined}
+ >
<CommandEmpty_Shadcn_>No schemas found</CommandEmpty_Shadcn_>
<CommandGroup_Shadcn_>
<ScrollArea className={(schemas || []).length > 7 ? 'h-[210px]' : ''}>