Skip to content

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

chore: update `react-resizable-panels` to v4 to support pixel width (#42990)

Ivan Vasilov637b6fb79216
diff --git a/apps/design-system/registry/default/example/resizable-demo-with-handle.tsx b/apps/design-system/registry/default/example/resizable-demo-with-handle.tsx
index fe58cf9aa4b..e68f6869109 100644
--- a/apps/design-system/registry/default/example/resizable-demo-with-handle.tsx
+++ b/apps/design-system/registry/default/example/resizable-demo-with-handle.tsx
@@ -2,22 +2,22 @@ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
export default function ResizableDemo() {
return (
- <ResizablePanelGroup direction="horizontal" className="max-w-md rounded-lg border">
- <ResizablePanel defaultSize={50}>
+ <ResizablePanelGroup orientation="horizontal" className="max-w-md rounded-lg border">
+ <ResizablePanel defaultSize="50">
<div className="flex h-[200px] items-center justify-center p-6">
<span className="font-semibold">One</span>
</div>
</ResizablePanel>
<ResizableHandle withHandle />
- <ResizablePanel defaultSize={50}>
- <ResizablePanelGroup direction="vertical">
- <ResizablePanel defaultSize={25}>
+ <ResizablePanel defaultSize="50">
+ <ResizablePanelGroup orientation="vertical">
+ <ResizablePanel defaultSize="25">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Two</span>
</div>
</ResizablePanel>
<ResizableHandle withHandle />
- <ResizablePanel defaultSize={75}>
+ <ResizablePanel defaultSize="75">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Three</span>
</div>
diff --git a/apps/design-system/registry/default/example/resizable-demo.tsx b/apps/design-system/registry/default/example/resizable-demo.tsx
index 521427569b1..9e0ea6354fa 100644
--- a/apps/design-system/registry/default/example/resizable-demo.tsx
+++ b/apps/design-system/registry/default/example/resizable-demo.tsx
@@ -2,22 +2,22 @@ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
export default function ResizableDemo() {
return (
- <ResizablePanelGroup direction="horizontal" className="max-w-md rounded-lg border">
- <ResizablePanel defaultSize={50}>
+ <ResizablePanelGroup orientation="horizontal" className="max-w-md rounded-lg border">
+ <ResizablePanel defaultSize="50">
<div className="flex h-[200px] items-center justify-center p-6">
<span className="font-semibold">One</span>
</div>
</ResizablePanel>
<ResizableHandle />
- <ResizablePanel defaultSize={50}>
- <ResizablePanelGroup direction="vertical">
- <ResizablePanel defaultSize={25}>
+ <ResizablePanel defaultSize="50">
+ <ResizablePanelGroup orientation="vertical">
+ <ResizablePanel defaultSize="25">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Two</span>
</div>
</ResizablePanel>
<ResizableHandle />
- <ResizablePanel defaultSize={75}>
+ <ResizablePanel defaultSize="75">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Three</span>
</div>
diff --git a/apps/design-system/registry/default/example/resizable-handle.tsx b/apps/design-system/registry/default/example/resizable-handle.tsx
index 29a14b6ca5d..517e5104ddf 100644
--- a/apps/design-system/registry/default/example/resizable-handle.tsx
+++ b/apps/design-system/registry/default/example/resizable-handle.tsx
@@ -3,16 +3,16 @@ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
export default function ResizableDemo() {
return (
<ResizablePanelGroup
- direction="horizontal"
+ orientation="horizontal"
className="min-h-[200px] max-w-md rounded-lg border"
>
- <ResizablePanel defaultSize={25}>
+ <ResizablePanel defaultSize="25">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Sidebar</span>
</div>
</ResizablePanel>
<ResizableHandle withHandle />
- <ResizablePanel defaultSize={75}>
+ <ResizablePanel defaultSize="75">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Content</span>
</div>
diff --git a/apps/design-system/registry/default/example/resizable-vertical.tsx b/apps/design-system/registry/default/example/resizable-vertical.tsx
index 6b00df0180e..367fef3bb89 100644
--- a/apps/design-system/registry/default/example/resizable-vertical.tsx
+++ b/apps/design-system/registry/default/example/resizable-vertical.tsx
@@ -2,14 +2,17 @@ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
export default function ResizableDemo() {
return (
- <ResizablePanelGroup direction="vertical" className="min-h-[200px] max-w-md rounded-lg border">
- <ResizablePanel defaultSize={25}>
+ <ResizablePanelGroup
+ orientation="vertical"
+ className="min-h-[200px] max-w-md rounded-lg border"
+ >
+ <ResizablePanel defaultSize="25">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Header</span>
</div>
</ResizablePanel>
<ResizableHandle />
- <ResizablePanel defaultSize={75}>
+ <ResizablePanel defaultSize="75">
<div className="flex h-full items-center justify-center p-6">
<span className="font-semibold">Content</span>
</div>
diff --git a/apps/studio/components/interfaces/Auth/Users/UserPanel.tsx b/apps/studio/components/interfaces/Auth/Users/UserPanel.tsx
index 47d9e9fba18..e85ae115477 100644
--- a/apps/studio/components/interfaces/Auth/Users/UserPanel.tsx
+++ b/apps/studio/components/interfaces/Auth/Users/UserPanel.tsx
@@ -57,7 +57,7 @@ export const UserPanel = () => {
return (
<>
<ResizableHandle withHandle />
- <ResizablePanel defaultSize={30} maxSize={45} minSize={30} className="bg-studio border-t">
+ <ResizablePanel defaultSize="30" maxSize="45" minSize="30" className="bg-studio border-t">
<Button
type="text"
className="absolute top-3 right-3 px-1"
diff --git a/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx b/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx
index 97d62ca60c9..2bd8d05201f 100644
--- a/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx
+++ b/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx
@@ -751,11 +751,11 @@ export const UsersV2 = () => {
</div>
<LoadingLine loading={isLoading || isRefetching || isFetchingNextPage} />
<ResizablePanelGroup
- direction="horizontal"
+ orientation="horizontal"
className="relative flex flex-grow bg-alternative min-h-0"
autoSaveId="query-performance-layout-v1"
>
- <ResizablePanel defaultSize={1}>
+ <ResizablePanel>
<div className="flex flex-col w-full h-full">
<DataGrid
ref={gridRef}
diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionTesterSheet.tsx b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionTesterSheet.tsx
index b8853cad5e9..b88c4e5ab85 100644
--- a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionTesterSheet.tsx
+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionTesterSheet.tsx
@@ -1,10 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { Loader2, Plus, Send, X } from 'lucide-react'
-import { useState } from 'react'
-import { useFieldArray, useForm } from 'react-hook-form'
-import * as z from 'zod'
-
import { useParams } from 'common'
import { RoleImpersonationPopover } from 'components/interfaces/RoleImpersonationSelector/RoleImpersonationPopover'
import { getKeys, useAPIKeysQuery } from 'data/api-keys/api-keys-query'
@@ -18,6 +13,9 @@ import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization
import { IS_PLATFORM } from 'lib/constants'
import { prettifyJSON } from 'lib/helpers'
import { getRoleImpersonationJWT } from 'lib/role-impersonation'
+import { Loader2, Plus, Send, X } from 'lucide-react'
+import { useState } from 'react'
+import { useFieldArray, useForm } from 'react-hook-form'
import {
RoleImpersonationStateContextProvider,
useGetImpersonatedRoleState,
@@ -51,6 +49,8 @@ import {
TextArea_Shadcn_ as Textarea,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
+import * as z from 'zod'
+
import { HTTP_METHODS } from './EdgeFunctionDetails.constants'
import { ErrorWithStatus, ResponseData } from './EdgeFunctionDetails.types'
@@ -289,7 +289,28 @@ export const EdgeFunctionTesterSheet = ({ visible, onClose }: EdgeFunctionTester
return (
<Sheet open={visible} onOpenChange={onClose}>
- <SheetContent size="default" className="flex flex-col gap-0 p-0">
+ <SheetContent
+ size="default"
+ className="flex flex-col gap-0 p-0"
+ onPointerDownOutside={(e) => {
+ // react-resizable-panels v4 registers document-level capture-phase pointer
+ // handlers that can interfere with Radix Dialog's outside-interaction detection.
+ // Prevent the sheet from closing when interacting with the resize handle.
+ const target = (e as CustomEvent<{ originalEvent: PointerEvent }>).detail?.originalEvent
+ ?.target as HTMLElement | null
+ if (target?.closest?.('[data-separator]')) {
+ e.preventDefault()
+ }
+ }}
+ onFocusOutside={(e) => {
+ // The v4 Separator explicitly calls .focus() on itself during pointerdown,
+ // which can trigger Radix Dialog's focus-outside detection.
+ const target = e.target as HTMLElement | null
+ if (target?.closest?.('[data-separator]')) {
+ e.preventDefault()
+ }
+ }}
+ >
<SheetHeader>
<SheetTitle>Test {functionSlug}</SheetTitle>
</SheetHeader>
@@ -299,7 +320,7 @@ export const EdgeFunctionTesterSheet = ({ visible, onClose }: EdgeFunctionTester
onSubmit={form.handleSubmit(onSubmit)}
className="flex-1 overflow-y-auto flex flex-col"
>
- <ResizablePanelGroup direction="vertical">
+ <ResizablePanelGroup orientation="vertical">
<ResizablePanel>
<div className="flex flex-col gap-y-4 p-5 h-full overflow-y-auto">
<FormField_Shadcn_
@@ -353,7 +374,7 @@ export const EdgeFunctionTesterSheet = ({ visible, onClose }: EdgeFunctionTester
</div>
</ResizablePanel>
<ResizableHandle withHandle />
- <ResizablePanel defaultSize={41} minSize={41} maxSize={83}>
+ <ResizablePanel defaultSize="41" minSize="41" maxSize="83">
<div className="h-full bg-surface-100 border-t flex-1 flex flex-col overflow-hidden">
{response ? (
<div className="h-full bg-surface-100 flex flex-col overflow-hidden">
diff --git a/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/MessageDetailsPanel.tsx b/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/MessageDetailsPanel.tsx
index f6b926ed0ef..0bbec45609b 100644
--- a/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/MessageDetailsPanel.tsx
+++ b/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/MessageDetailsPanel.tsx
@@ -77,11 +77,15 @@ export const MessageDetailsPanel = ({
return (
<ResizablePanel
- defaultSize={30}
- maxSize={45}
- minSize={30}
+ defaultSize="30"
+ maxSize="45"
+ minSize="30"
collapsible
- onCollapse={() => setSelectedMessage(null)}
+ onResize={(panelSize) => {
+ if (panelSize.asPercentage === 0) {
+ setSelectedMessage(null)
+ }
+ }}
className="bg-studio border-t pointer-events-auto"
>
<Button
diff --git a/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueDataGrid.tsx b/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueDataGrid.tsx
index c914cfd85b6..018b1d43f25 100644
--- a/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueDataGrid.tsx
+++ b/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueDataGrid.tsx
@@ -4,13 +4,13 @@ import { useRouter } from 'next/router'
import { parseAsInteger, useQueryState } from 'nuqs'
import { UIEvent, useMemo, useRef } from 'react'
import DataGrid, { Column, DataGridHandle, Row } from 'react-data-grid'
-
-import AlertError from 'components/ui/AlertError'
-import { PostgresQueueMessage } from 'data/database-queues/database-queue-messages-infinite-query'
-import type { ResponseError } from 'types'
-import { Badge, Button, ResizableHandle, ResizablePanel, ResizablePanelGroup, cn } from 'ui'
+import { Badge, Button, cn, ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
+
import { DATE_FORMAT, MessageDetailsPanel } from './MessageDetailsPanel'
+import AlertError from '@/components/ui/AlertError'
+import { PostgresQueueMessage } from '@/data/database-queues/database-queue-messages-infinite-query'
+import type { ResponseError } from '@/types'
interface QueueDataGridProps {
error?: ResponseError | null
@@ -179,8 +179,6 @@ export const QueueMessagesDataGrid = ({
if (typeof idx === 'number' && idx >= 0) {
setSelectedMessageId(props.row.msg_id)
gridRef.current?.scrollToCell({ idx: 0, rowIdx: idx })
- const { messageId, ...rest } = router.query
- router.push({ ...router, query: { ...rest, messageId: props.row.msg_id } })
}
}}
/>
@@ -211,11 +209,11 @@ export const QueueMessagesDataGrid = ({
}}
/>
<ResizablePanelGroup
- direction="horizontal"
+ orientation="horizontal"
className="absolute inset-0 z-10 pointer-events-none"
autoSaveId="queue-messages-layout-v1"
>
- <ResizablePanel defaultSize={1} />
+ <ResizablePanel />
{selectedMessage && (
<>
<ResizableHandle withHandle className="pointer-events-auto" />
diff --git a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
index 07817830d7e..a69ca95d9aa 100644
--- a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
+++ b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
@@ -1,23 +1,23 @@
-import { X } from 'lucide-react'
-import { useRef } from 'react'
-import DataGrid, { Column, DataGridHandle, Row } from 'react-data-grid'
-import ReactMarkdown from 'react-markdown'
-
import { useParams } from 'common'
import { LINTER_LEVELS } from 'components/interfaces/Linter/Linter.constants'
import {
LintCategoryBadge,
LintEntity,
- NoIssuesFound,
lintInfoMap,
+ NoIssuesFound,
} from 'components/interfaces/Linter/Linter.utils'
import { Lint } from 'data/lint/lint-query'
-import { useRouter } from 'next/router'
import { useTrack } from 'lib/telemetry/track'
-import { Button, ResizableHandle, ResizablePanel, ResizablePanelGroup, cn } from 'ui'
+import { X } from 'lucide-react'
+import { useRouter } from 'next/router'
+import { useRef } from 'react'
+import DataGrid, { Column, DataGridHandle, Row } from 'react-data-grid'
+import ReactMarkdown from 'react-markdown'
+import { Button, cn, ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
-import { EntityTypeIcon } from './Linter.utils'
+
import LintDetail from './LintDetail'
+import { EntityTypeIcon } from './Linter.utils'
interface LinterDataGridProps {
isLoading: boolean
@@ -117,11 +117,11 @@ const LinterDataGrid = ({
return (
<ResizablePanelGroup
- direction="horizontal"
+ orientation="horizontal"
className="relative flex flex-grow bg-alternative min-h-0"
autoSaveId="linter-layout-v1"
>
- <ResizablePanel defaultSize={1}>
+ <ResizablePanel>
<DataGrid
ref={gridRef}
style={{ height: '100%' }}
@@ -177,9 +177,9 @@ const LinterDataGrid = ({
<>
<ResizableHandle withHandle />
<ResizablePanel
- defaultSize={30}
- maxSize={45}
- minSize={30}
+ defaultSize="30"
+ maxSize="45"
+ minSize="30"
className="bg-studio border-t flex flex-col h-full"
>
<div className="flex items-center justify-between w-full border-b py-3 px-6">
diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
index 80a76d06d68..e403547c221 100644
--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
@@ -784,10 +784,10 @@ export const SQLEditor = () => {
<div className="flex h-full">
<ResizablePanelGroup
className="relative"
- direction="vertical"
+ orientation="vertical"
autoSaveId={LOCAL_STORAGE_KEYS.SQL_EDITOR_SPLIT_SIZE}
>
- <ResizablePanel defaultSize={50} maxSize={70}>
+ <ResizablePanel defaultSize="50" maxSize="70">
<div className="flex-grow overflow-y-auto border-b h-full">
{isLoading ? (
<div className="flex h-full w-full items-center justify-center">
@@ -898,7 +898,7 @@ export const SQLEditor = () => {
<ResizableHandle withHandle />
- <ResizablePanel defaultSize={50} maxSize={70}>
+ <ResizablePanel defaultSize="50" maxSize="70">
{isLoading ? (
<div className="flex h-full w-full items-center justify-center">
<Loader2 className="animate-spin text-brand" />
diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/ChartConfig.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/ChartConfig.tsx
index 97e270265f8..73126157f46 100644
--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/ChartConfig.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/ChartConfig.tsx
@@ -132,10 +132,10 @@ export const ChartConfig = ({
}
return (
- <ResizablePanelGroup direction="horizontal" className="flex-grow h-full">
- <ResizablePanel className="p-4 h-full" defaultSize={75}>
+ <ResizablePanelGroup orientation="horizontal" className="flex-grow h-full">
+ <ResizablePanel className="p-4 h-full" defaultSize="75">
{!hasConfig ? (
- <ResizablePanel className="p-4 h-full" defaultSize={75}>
+ <ResizablePanel className="p-4 h-full" defaultSize="75">
<NoDataPlaceholder
size="normal"
title="Configure your chart"
@@ -173,8 +173,8 @@ export const ChartConfig = ({
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel
- defaultSize={25}
- minSize={15}
+ defaultSize="25"
+ minSize="15"
className="px-3 py-3 space-y-4 !overflow-y-auto"
>
<div className="flex justify-between items-center h-5">
diff --git a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx
index aa0d6a01e18..09c2fab36b3 100644
--- a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx
+++ b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx
@@ -393,14 +393,12 @@ export const LogTable = ({
return (
<section className={'h-full flex w-full flex-col flex-1'}>
{!queryType && <LogsExplorerTableHeader />}
-
- <ResizablePanelGroup direction="horizontal" key="log-table">
+ <ResizablePanelGroup orientation="horizontal">
<ResizablePanel
id="log-table-content"
- order={1}
- minSize={panelContentMinSize}
- maxSize={panelContentMaxSize}
- defaultSize={panelContentMaxSize}
+ minSize={`${panelContentMinSize}`}
+ maxSize={`${panelContentMaxSize}`}
+ defaultSize={`${panelContentMaxSize}`}
>
<DataGrid
role="table"
@@ -459,10 +457,9 @@ export const LogTable = ({
<ResizableHandle withHandle />
<ResizablePanel
id="log-table-panel"
- order={2}
- minSize={100 - panelContentMaxSize}
- maxSize={100 - panelContentMinSize}
- defaultSize={100 - panelContentMaxSize}
+ minSize={`${100 - panelContentMaxSize}`}
+ maxSize={`${100 - panelContentMinSize}`}
+ defaultSize={`${100 - panelContentMaxSize}`}
>
<LogSelection
isLoading={isSelectedLogLoading || false}
diff --git a/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsx b/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsx
index 6aae086d11b..b9958697eac 100644
--- a/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsx
+++ b/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsx
@@ -1,5 +1,3 @@
-import { useState } from 'react'
-
import { useParams } from 'common'
import { useDataTable } from 'components/ui/DataTable/providers/DataTableProvider'
import {
@@ -7,7 +5,9 @@ import {
useUnifiedLogInspectionQuery,
} from 'data/logs/unified-log-inspection-query'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
+import { useState } from 'react'
import {
+ cn,
CodeBlock,
ResizableHandle,
ResizablePanel,
@@ -16,19 +16,19 @@ import {
TabsContent_Shadcn_ as TabsContent,
TabsList_Shadcn_ as TabsList,
TabsTrigger_Shadcn_ as TabsTrigger,
- cn,
} from 'ui'
+
+import { MemoizedRequestStartedBlock } from './ServiceFlow/components/blocks/RequestStartedBlock'
+import { MemoizedResponseCompletedBlock } from './ServiceFlow/components/blocks/ResponseCompletedBlock'
import {
MemoizedEdgeFunctionBlock,
MemoizedGoTrueBlock,
MemoizedNetworkBlock,
- MemoizedPostgRESTBlock,
MemoizedPostgresBlock,
+ MemoizedPostgRESTBlock,
MemoizedStorageBlock,
} from './ServiceFlow/components/ServiceBlocks'
import { ServiceFlowHeader } from './ServiceFlow/components/ServiceFlowHeader'
-import { MemoizedRequestStartedBlock } from './ServiceFlow/components/blocks/RequestStartedBlock'
-import { MemoizedResponseCompletedBlock } from './ServiceFlow/components/blocks/ResponseCompletedBlock'
import { ColumnSchema } from './UnifiedLogs.schema'
import { QuerySearchParamsType } from './UnifiedLogs.types'
@@ -89,9 +89,8 @@ export function ServiceFlowPanel({
<ResizableHandle withHandle className="z-10" />
<ResizablePanel
id="log-sidepanel"
- order={2}
- defaultSize={1}
- maxSize={40}
+ minSize={448}
+ maxSize={720}
className={cn(
'bg-dash-sidebar',
'z-40',
@@ -99,7 +98,6 @@ export function ServiceFlowPanel({
'md:absolute md:h-auto',
// ' md:w-3/4',
'xl:z-[1]',
- 'min-w-[28rem] max-w-[45rem]',
'xl:relative xl:border-l-0'
)}
>
diff --git a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.tsx b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.tsx
index 2e62aa4f5f1..96a4b519e33 100644
--- a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.tsx
+++ b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.tsx
@@ -23,6 +23,7 @@ import {
ResizablePanel,
ResizablePanelGroup,
Separator,
+ useIsMobile,
} from 'ui'
import { RefreshButton } from '../../ui/DataTable/RefreshButton'
@@ -312,6 +313,17 @@ export const UnifiedLogs = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [rowSelection, selectedRow, isLoading, isFetching])
+ const isMobile = useIsMobile()
+ const [isFilterBarOpen, setIsFilterBarOpen] = useState(!isMobile)
+
+ useEffect(() => {
+ if (isMobile) {
+ setIsFilterBarOpen(false)
+ } else {
+ setIsFilterBarOpen(true)
+ }
+ }, [isMobile])
+
return (
<DataTableProvider
table={table}
@@ -330,15 +342,14 @@ export const UnifiedLogs = () => {
getFacetedUniqueValues={getFacetedUniqueValues(facets)}
>
<DataTableSideBarLayout topBarHeight={topBarHeight}>
- <ResizablePanelGroup direction="horizontal" autoSaveId="logs-layout">
- <FilterSideBar dateRangeDisabled={{ after: new Date() }} />
- <ResizableHandle
- withHandle
- // disabled={resizableSidebar ? false : true}
- className="group-data-[expanded=false]/controls:hidden hidden md:flex"
+ <ResizablePanelGroup orientation="horizontal" autoSaveId="logs-layout">
+ <FilterSideBar
+ isFilterBarOpen={isFilterBarOpen}
+ setIsFilterBarOpen={setIsFilterBarOpen}
+ dateRangeDisabled={{ after: new Date() }}
/>
+ <ResizableHandle withHandle />
<ResizablePanel
- order={2}
id="panel-right"
className="flex max-w-full flex-1 flex-col overflow-hidden"
>
@@ -363,6 +374,8 @@ export const UnifiedLogs = () => {
/>
) : null,
]}
+ isFilterBarOpen={isFilterBarOpen}
+ setIsFilterBarOpen={setIsFilterBarOpen}
/>
<TimelineChart
data={unifiedLogsChart}
@@ -375,16 +388,12 @@ export const UnifiedLogs = () => {
/>
</DataTableHeaderLayout>
<Separator />
- <ResizablePanelGroup direction="horizontal" className="w-full h-full">
- <ResizablePanel
- defaultSize={selectedRowKey ? 60 : 100}
- minSize={30}
- className="h-full"
- >
- <ResizablePanelGroup key="main-logs" direction="vertical" className="h-full">
+ <ResizablePanelGroup orientation="horizontal" className="w-full h-full">
+ <ResizablePanel minSize="30" className="h-full">
+ <ResizablePanelGroup key="main-logs" orientation="vertical" className="h-full">
<ResizablePanel
- defaultSize={100}
- minSize={30}
+ defaultSize="100"
+ minSize="30"
className={cn(
'bg',
isFetchingButNotPaginating && 'opacity-60 transition-opacity duration-150'
diff --git a/apps/studio/components/interfaces/UnifiedLogs/components/LogsListPanel.tsx b/apps/studio/components/interfaces/UnifiedLogs/components/LogsListPanel.tsx
index 1da4ea93035..b36cff647d7 100644
--- a/apps/studio/components/interfaces/UnifiedLogs/components/LogsListPanel.tsx
+++ b/apps/studio/components/interfaces/UnifiedLogs/components/LogsListPanel.tsx
@@ -14,10 +14,9 @@ export const LogsListPanel = ({ selectedRow }: { selectedRow?: Row<any> }) => {
<>
<ResizableHandle withHandle disabled={!open} />
<ResizablePanel
- order={2}
- defaultSize={1}
- maxSize={50}
- minSize={open ? 16 : 12}
+ defaultSize="1"
+ maxSize="50"
+ minSize={open ? '16' : '12'}
className={cn(!open ? '!h-12 max-h-12' : 'h-min-16 h-max-32')}
>
<div className="h-full flex flex-col overflow-hidden">
diff --git a/apps/studio/components/layouts/DefaultLayout.tsx b/apps/studio/components/layouts/DefaultLayout.tsx
index 01fd1703ffc..210d185d5b8 100644
--- a/apps/studio/components/layouts/DefaultLayout.tsx
+++ b/apps/studio/components/layouts/DefaultLayout.tsx
@@ -4,7 +4,7 @@ import { Sidebar } from 'components/interfaces/Sidebar'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { useCheckLatestDeploy } from 'hooks/use-check-latest-deploy'
import { useRouter } from 'next/router'
-import { PropsWithChildren } from 'react'
+import { PropsWithChildren, useEffect, useState } from 'react'
import { useAppStateSnapshot } from 'state/app-state'
import { ResizablePanel, ResizablePanelGroup, SidebarProvider } from 'ui'
@@ -58,6 +58,18 @@ export const DefaultLayout = ({
const contentMinSizePercentage = 50
const contentMaxSizePercentage = 70
+ const [isMounted, setIsMounted] = useState(false)
+
+ useEffect(() => {
+ setIsMounted(true)
+ }, [])
+
+ // This is required to prevent layout shift when rendering resizable panels (they initially render at 50%, then shift
+ // to whatever is specified).
+ if (!isMounted) {
+ return null
+ }
+
return (
<SidebarProvider defaultOpen={false}>
<LayoutSidebarProvider>
@@ -82,25 +94,23 @@ export const DefaultLayout = ({
{!router.pathname.startsWith('/account') && <Sidebar />}
{/* Main Content with Layout Sidebar */}
<ResizablePanelGroup
- direction="horizontal"
+ orientation="horizontal"
className="h-full w-full overflow-x-hidden flex-1 flex flex-row gap-0"
autoSaveId="default-layout-content"
>
<ResizablePanel
id="panel-content"
- order={1}
className="w-full"
- minSize={contentMinSizePercentage}
- maxSize={contentMaxSizePercentage}
- defaultSize={contentMaxSizePercentage}
+ minSize={`${contentMinSizePercentage}`}
+ maxSize={`${contentMaxSizePercentage}`}
+ defaultSize={`${contentMaxSizePercentage}`}
>
<div className="h-full overflow-y-auto">{children}</div>
</ResizablePanel>
<LayoutSidebar
- order={2}
- minSize={100 - contentMaxSizePercentage}
- maxSize={100 - contentMinSizePercentage}
- defaultSize={100 - contentMaxSizePercentage}
+ minSize={`${100 - contentMaxSizePercentage}`}
+ maxSize={`${100 - contentMinSizePercentage}`}
+ defaultSize={`${100 - contentMaxSizePercentage}`}
/>
</ResizablePanelGroup>
</div>
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx
index bf579f21bd8..889e07bc124 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx
@@ -104,7 +104,7 @@ describe('LayoutSidebar', () => {
const renderSidebar = () =>
render(
- <ResizablePanelGroup direction="horizontal">
+ <ResizablePanelGroup orientation="horizontal">
<ResizablePanel>
<div />
</ResizablePanel>
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.tsx
index 51f1489705b..3e3161f0ce4 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.tsx
@@ -4,17 +4,15 @@ import { ResizableHandle, ResizablePanel, cn } from 'ui'
// Having these params as props as otherwise it's quite hard to visually check the sizes in DefaultLayout
// as react resizeable panels requires all these values to be valid to render correctly
interface LayoutSidebarProps {
- order?: number
- minSize?: number
- maxSize?: number
- defaultSize?: number
+ minSize?: string | number
+ maxSize?: string | number
+ defaultSize?: string | number
}
export const LayoutSidebar = ({
- order = 2,
- minSize = 30,
- maxSize = 50,
- defaultSize = 30,
+ minSize = '30',
+ maxSize = '50',
+ defaultSize = '30',
}: LayoutSidebarProps) => {
const { activeSidebar } = useSidebarManagerSnapshot()
@@ -26,7 +24,6 @@ export const LayoutSidebar = ({
<ResizablePanel
id="panel-side"
key={activeSidebar?.id ?? 'default'}
- order={order}
defaultSize={defaultSize}
minSize={minSize}
maxSize={maxSize}
diff --git a/apps/studio/components/layouts/ProjectLayout/index.tsx b/apps/studio/components/layouts/ProjectLayout/index.tsx
index 5c63046e4dc..b54a2584a5a 100644
--- a/apps/studio/components/layouts/ProjectLayout/index.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/index.tsx
@@ -1,20 +1,17 @@
import { mergeRefs, useParams } from 'common'
-import { CreateBranchModal } from 'components/interfaces/BranchManagement/CreateBranchModal'
-import { ProjectAPIDocs } from 'components/interfaces/ProjectAPIDocs/ProjectAPIDocs'
-import { ResourceExhaustionWarningBanner } from 'components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner'
import { AnimatePresence, motion } from 'framer-motion'
-import { useCustomContent } from 'hooks/custom-content/useCustomContent'
-import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
-import { withAuth } from 'hooks/misc/withAuth'
-import { usePHFlag } from 'hooks/ui/useFlag'
-import { PROJECT_STATUS } from 'lib/constants'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { forwardRef, Fragment, PropsWithChildren, ReactNode, useEffect } from 'react'
-import { useAppStateSnapshot } from 'state/app-state'
-import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
-import { cn, LogoLoader, ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
+import {
+ cn,
+ LogoLoader,
+ ResizableHandle,
+ ResizablePanel,
+ ResizablePanelGroup,
+ useIsMobile,
+ usePanelRef,
+} from 'ui'
import MobileSheetNav from 'ui-patterns/MobileSheetNav/MobileSheetNav'
import { useEditorType } from '../editors/EditorsLayout.hooks'
@@ -31,6 +28,17 @@ import RestartingState from './RestartingState'
import { RestoreFailedState } from './RestoreFailedState'
import RestoringState from './RestoringState'
import { UpgradingState } from './UpgradingState'
+import { CreateBranchModal } from '@/components/interfaces/BranchManagement/CreateBranchModal'
+import { ProjectAPIDocs } from '@/components/interfaces/ProjectAPIDocs/ProjectAPIDocs'
+import { ResourceExhaustionWarningBanner } from '@/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner'
+import { useCustomContent } from '@/hooks/custom-content/useCustomContent'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
+import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
+import { withAuth } from '@/hooks/misc/withAuth'
+import { usePHFlag } from '@/hooks/ui/useFlag'
+import { PROJECT_STATUS } from '@/lib/constants'
+import { useAppStateSnapshot } from '@/state/app-state'
+import { useDatabaseSelectorStateSnapshot } from '@/state/database-selector'
// [Joshen] This is temporary while we unblock users from managing their project
// if their project is not responding well for any reason. Eventually needs a bit of an overhaul
@@ -96,9 +104,13 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec
const { appTitle } = useCustomContent(['app:title'])
const titleSuffix = appTitle || 'Supabase'
+ const isMobile = useIsMobile()
+
const editor = useEditorType()
const forceShowProductMenu = editor === undefined
- const sideBarIsOpen = forceShowProductMenu || showSidebar
+ const sideBarIsOpen = (forceShowProductMenu || showSidebar) && !isMobile
+
+ const panelRef = usePanelRef()
const projectName = selectedProject?.name
const organizationName = selectedOrganization?.name
@@ -112,10 +124,6 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec
router.pathname.includes('/project/[ref]/logs')
const showPausedState = isPaused && !ignorePausedState
- const sidebarMinSizePercentage = 1
- const sidebarDefaultSizePercentage = 15
- const sidebarMaxSizePercentage = 33
-
return (
<>
<Head>
@@ -133,45 +141,35 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec
<meta name="description" content="Supabase Studio" />
</Head>
<div className="flex flex-row h-full w-full">
- <ResizablePanelGroup direction="horizontal">
- {productMenu && (
+ <ResizablePanelGroup orientation="horizontal">
+ {productMenu && sideBarIsOpen && (
<ResizablePanel
- order={1}
- minSize={sidebarMinSizePercentage}
- maxSize={sidebarMaxSizePercentage}
- defaultSize={sidebarDefaultSizePercentage}
+ panelRef={panelRef}
+ minSize={256}
+ maxSize={resizableSidebar ? 512 : 256}
+ defaultSize={256}
id="panel-left"
- className={cn(
- 'hidden md:block',
- 'transition-[max-width,min-width,width] duration-[120ms]',
- sideBarIsOpen
- ? resizableSidebar
- ? 'min-w-64 max-w-[32rem]'
- : 'min-w-64 max-w-64'
- : 'w-0 flex-shrink-0 max-w-0'
- )}
+ disabled={!resizableSidebar}
>
- {sideBarIsOpen && (
- <AnimatePresence initial={false}>
- <motion.div
- initial={{ width: 0, opacity: 0, height: '100%' }}
- animate={{ width: 'auto', opacity: 1, height: '100%' }}
- exit={{ width: 0, opacity: 0, height: '100%' }}
- className="h-full"
- transition={{ duration: 0.12 }}
+ <AnimatePresence initial={false}>
+ <motion.div
+ initial={{ width: 0, opacity: 0, height: '100%' }}
+ animate={{ width: 'auto', opacity: 1, height: '100%' }}
+ exit={{ width: 0, opacity: 0, height: '100%' }}
+ className="h-full"
+ transition={{ duration: 0.12 }}
+ >
+ <MenuBarWrapper
+ isLoading={isLoading}
+ isBlocking={isBlocking}
+ productMenu={productMenu}
>
- <MenuBarWrapper
- isLoading={isLoading}
- isBlocking={isBlocking}
- productMenu={productMenu}
- >
- <ProductMenuBar title={product} className={productMenuClassName}>
- {productMenu}
- </ProductMenuBar>
- </MenuBarWrapper>
- </motion.div>
- </AnimatePresence>
- )}
+ <ProductMenuBar title={product} className={productMenuClassName}>
+ {productMenu}
+ </ProductMenuBar>
+ </MenuBarWrapper>
+ </motion.div>
+ </AnimatePresence>
</ResizablePanel>
)}
{productMenu && sideBarIsOpen && (
@@ -182,12 +180,8 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec
/>
)}
<ResizablePanel
- order={2}
- minSize={100 - sidebarMaxSizePercentage}
- maxSize={100 - sidebarMinSizePercentage}
- defaultSize={100 - sidebarDefaultSizePercentage}
- id="panel-project-content"
className={cn('h-full flex flex-col w-full xl:min-w-[600px] bg-dash-sidebar')}
+ id="panel-project-content"
>
<main
className="h-full flex flex-col flex-1 w-full overflow-y-auto overflow-x-hidden @container"
diff --git a/apps/studio/components/ui/DataTable/DataTableToolbar.tsx b/apps/studio/components/ui/DataTable/DataTableToolbar.tsx
index b2e4bf7098a..8d6ce347177 100644
--- a/apps/studio/components/ui/DataTable/DataTableToolbar.tsx
+++ b/apps/studio/components/ui/DataTable/DataTableToolbar.tsx
@@ -1,26 +1,30 @@
+import { useHotKey } from 'hooks/ui/useHotKey'
import { PanelLeftClose, PanelLeftOpen } from 'lucide-react'
import { ReactNode, useMemo } from 'react'
-
-import { useHotKey } from 'hooks/ui/useHotKey'
import { Button, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
+
import { formatCompactNumber } from './DataTable.utils'
import { DataTableFilterControlsDrawer } from './DataTableFilters/DataTableFilterControlsDrawer'
import { DataTableResetButton } from './DataTableResetButton'
import { DataTableViewOptions } from './DataTableViewOptions'
import { Kbd } from './primitives/Kbd'
-import { useControls } from './providers/ControlsProvider'
import { useDataTable } from './providers/DataTableProvider'
interface DataTableToolbarProps {
renderActions?: () => ReactNode
+ isFilterBarOpen: boolean
+ setIsFilterBarOpen: React.Dispatch<React.SetStateAction<boolean>>
}
-export function DataTableToolbar({ renderActions }: DataTableToolbarProps) {
+export function DataTableToolbar({
+ renderActions,
+ isFilterBarOpen,
+ setIsFilterBarOpen,
+}: DataTableToolbarProps) {
const { table, isLoading, columnFilters } = useDataTable()
- const { open, setOpen } = useControls()
const filters = table.getState().columnFilters
- useHotKey(() => setOpen((prev) => !prev), 'b')
+ useHotKey(() => setIsFilterBarOpen((prev) => !prev), 'b')
const rows = useMemo(
() => ({
@@ -38,11 +42,11 @@ export function DataTableToolbar({ renderActions }: DataTableToolbarProps) {
<Button
size="tiny"
type="default"
- icon={open ? <PanelLeftClose /> : <PanelLeftOpen />}
- onClick={() => setOpen((prev) => !prev)}
+ icon={isFilterBarOpen ? <PanelLeftClose /> : <PanelLeftOpen />}
+ onClick={() => setIsFilterBarOpen((prev) => !prev)}
className="hidden sm:flex"
>
- <span className="hidden md:block">{open ? 'Hide' : 'Show'} Controls</span>
+ <span className="hidden md:block">{isFilterBarOpen ? 'Hide' : 'Show'} Controls</span>
</Button>
</TooltipTrigger>
<TooltipContent side="right">
diff --git a/apps/studio/components/ui/DataTable/FilterSideBar.tsx b/apps/studio/components/ui/DataTable/FilterSideBar.tsx
index 0811399f464..1797cb30cca 100644
--- a/apps/studio/components/ui/DataTable/FilterSideBar.tsx
+++ b/apps/studio/components/ui/DataTable/FilterSideBar.tsx
@@ -1,8 +1,8 @@
import { useFlag, useParams } from 'common'
import Link from 'next/link'
import { useRouter } from 'next/router'
-import React from 'react'
-import { Button, cn, ResizablePanel } from 'ui'
+import React, { useEffect } from 'react'
+import { Button, cn, ResizablePanel, usePanelRef } from 'ui'
import { FeaturePreviewSidebarPanel } from '../FeaturePreviewSidebarPanel'
import { DateRangeDisabled } from './DataTable.types'
@@ -13,10 +13,16 @@ import { useUnifiedLogsPreview } from '@/components/interfaces/App/FeaturePrevie
import { LOG_DRAIN_TYPES } from '@/components/interfaces/LogDrains/LogDrains.constants'
interface FilterSideBarProps {
+ isFilterBarOpen: boolean
+ setIsFilterBarOpen: React.Dispatch<React.SetStateAction<boolean>>
dateRangeDisabled?: DateRangeDisabled
}
-export function FilterSideBar({ dateRangeDisabled }: FilterSideBarProps) {
+export function FilterSideBar({
+ isFilterBarOpen,
+ setIsFilterBarOpen,
+ dateRangeDisabled,
+}: FilterSideBarProps) {
const router = useRouter()
const { ref } = useParams()
const { table } = useDataTable()
@@ -29,18 +35,31 @@ export function FilterSideBar({ dateRangeDisabled }: FilterSideBarProps) {
router.push(`/project/${ref}/logs/explorer`)
}
+ const panelRef = usePanelRef()
+
+ useEffect(() => {
+ if (isFilterBarOpen) {
+ panelRef.current?.expand()
+ } else {
+ panelRef.current?.collapse()
+ }
+ }, [isFilterBarOpen, panelRef])
+
return (
<ResizablePanel
- order={1}
- maxSize={33}
- defaultSize={1}
+ panelRef={panelRef}
+ maxSize={512}
+ minSize={256}
id="panel-left"
- className={cn(
- 'flex flex-col w-full',
- 'min-w-64 max-w-[32rem]',
- 'group-data-[expanded=false]/controls:hidden',
- 'hidden sm:flex'
- )}
+ collapsible
+ onResize={(size) => {
+ if (size.inPixels === 0) {
+ setIsFilterBarOpen(false)
+ } else if (!isFilterBarOpen) {
+ setIsFilterBarOpen(true)
+ }
+ }}
+ className={cn('flex flex-col w-full')}
>
<div className="border-b border-border px-4 md:top-0">
<div className="flex h-[48px] items-center justify-between gap-3">
diff --git a/apps/studio/components/ui/DataTable/providers/ControlsProvider.tsx b/apps/studio/components/ui/DataTable/providers/ControlsProvider.tsx
deleted file mode 100644
index ccdf799e8f1..00000000000
--- a/apps/studio/components/ui/DataTable/providers/ControlsProvider.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useLocalStorage } from 'hooks/misc/useLocalStorage'
-import { createContext, Dispatch, SetStateAction, useContext } from 'react'
-
-interface ControlsContextType {
- open: boolean
- setOpen: Dispatch<SetStateAction<boolean>>
-}
-
-export const ControlsContext = createContext<ControlsContextType | null>(null)
-
-export function ControlsProvider({ children }: { children: React.ReactNode }) {
- const [open, setOpen] = useLocalStorage('data-table-controls', true)
-
- return (
- <ControlsContext.Provider value={{ open, setOpen }}>
- <div
- // REMINDER: access the data-expanded state with tailwind via `group-data-[expanded=true]/controls:block`
- // In tailwindcss v4, we could even use `group-data-expanded/controls:block`
- className="group/controls h-full"
- data-expanded={open}
- >
- {children}
- </div>
- </ControlsContext.Provider>
- )
-}
-
-export function useControls() {
- const context = useContext(ControlsContext)
-
- if (!context) {
- throw new Error('useControls must be used within a ControlsProvider')
- }
-
- return context as ControlsContextType
-}
diff --git a/apps/studio/components/ui/DataTable/providers/DataTableProvider.tsx b/apps/studio/components/ui/DataTable/providers/DataTableProvider.tsx
index 2515c748a59..7a49998c1a8 100644
--- a/apps/studio/components/ui/DataTable/providers/DataTableProvider.tsx
+++ b/apps/studio/components/ui/DataTable/providers/DataTableProvider.tsx
@@ -7,11 +7,10 @@ import type {
Table,
VisibilityState,
} from '@tanstack/react-table'
+import { QuerySearchParamsType } from 'components/interfaces/UnifiedLogs/UnifiedLogs.types'
import { createContext, ReactNode, useContext, useMemo } from 'react'
-import { QuerySearchParamsType } from 'components/interfaces/UnifiedLogs/UnifiedLogs.types'
import { DataTableFilterField } from '../DataTable.types'
-import { ControlsProvider } from './ControlsProvider'
// REMINDER: read about how to move controlled state out of the useReactTable hook
// https://github.com/TanStack/table/discussions/4005#discussioncomment-7303569
@@ -66,11 +65,7 @@ export function DataTableProvider<TData, TValue>({
[props]
)
- return (
- <DataTableContext.Provider value={value}>
- <ControlsProvider>{children}</ControlsProvider>
- </DataTableContext.Provider>
- )
+ return <DataTableContext.Provider value={value}>{children}</DataTableContext.Provider>
}
export function useDataTable<TData, TValue>() {
diff --git a/apps/studio/pages/project/[ref]/logs/explorer/index.tsx b/apps/studio/pages/project/[ref]/logs/explorer/index.tsx
index 93ca9663537..f0d6a7c6387 100644
--- a/apps/studio/pages/project/[ref]/logs/explorer/index.tsx
+++ b/apps/studio/pages/project/[ref]/logs/explorer/index.tsx
@@ -378,10 +378,10 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
<div className="w-full h-full mx-auto">
<ResizablePanelGroup
className="w-full h-full max-h-screen"
- direction="vertical"
+ orientation="vertical"
autoSaveId={LOCAL_STORAGE_KEYS.LOG_EXPLORER_SPLIT_SIZE}
>
- <ResizablePanel collapsible minSize={5}>
+ <ResizablePanel collapsible minSize="5">
<LogsQueryPanel
value={datePickerValue}
onDateChange={handleDateChange}
@@ -401,7 +401,7 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
/>
</ResizablePanel>
<ResizableHandle withHandle />
- <ResizablePanel collapsible minSize={5} className="overflow-auto">
+ <ResizablePanel collapsible minSize="5" className="overflow-auto">
<LoadingOpacity active={isLoading}>
<LogTable
isSaving={isUpsertingContent}
diff --git a/apps/studio/state/app-state.ts b/apps/studio/state/app-state.ts
index d4533c5462e..aed3c6826e8 100644
--- a/apps/studio/state/app-state.ts
+++ b/apps/studio/state/app-state.ts
@@ -1,6 +1,5 @@
-import { proxy, snapshot, useSnapshot } from 'valtio'
-
import { LOCAL_STORAGE_KEYS as COMMON_LOCAL_STORAGE_KEYS } from 'common'
+import { proxy, snapshot, useSnapshot } from 'valtio'
const getInitialState = () => {
return {
diff --git a/apps/studio/tests/setup/polyfills.ts b/apps/studio/tests/setup/polyfills.ts
index e37e5482f5a..ba913603e4c 100644
--- a/apps/studio/tests/setup/polyfills.ts
+++ b/apps/studio/tests/setup/polyfills.ts
@@ -1,8 +1,8 @@
-import { TextDecoder, TextEncoder } from 'node:util'
import { ReadableStream, TransformStream } from 'node:stream/web'
-import { vi } from 'vitest'
-import { configMocks } from 'jsdom-testing-mocks'
+import { TextDecoder, TextEncoder } from 'node:util'
import { act } from '@testing-library/react'
+import { configMocks } from 'jsdom-testing-mocks'
+import { vi } from 'vitest'
configMocks({ act })
diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx
index eca52e66170..e145d04e445 100644
--- a/packages/ui/index.tsx
+++ b/packages/ui/index.tsx
@@ -298,5 +298,6 @@ export * from './src/components/Icon/icons/IconYoutubeSolid'
// Export hooks
export * from './src/lib/Hooks'
+export * from './src/components/hooks/use-mobile'
export * from './src/components/KeyboardShortcut/KeyboardShortcut'
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 8e1909e2277..ddd2dc3cc0c 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -72,7 +72,7 @@
"react-hook-form": "^7.45.0",
"react-intersection-observer": "^9.8.2",
"react-medium-image-zoom": "^5.2.4",
- "react-resizable-panels": "^3.0.0",
+ "react-resizable-panels": "^4.6.5",
"react-syntax-highlighter": "^15.6.6",
"recharts": "catalog:",
"sonner": "^1.5.0",
diff --git a/packages/ui/src/components/shadcn/ui/resizable.tsx b/packages/ui/src/components/shadcn/ui/resizable.tsx
index e36e712932d..d8ed45b9ac1 100644
--- a/packages/ui/src/components/shadcn/ui/resizable.tsx
+++ b/packages/ui/src/components/shadcn/ui/resizable.tsx
@@ -2,54 +2,115 @@
import { GripVertical } from 'lucide-react'
import * as ResizablePrimitive from 'react-resizable-panels'
-import { ImperativePanelHandle } from 'react-resizable-panels'
import { cn } from '../../../lib/utils/cn'
+// This is to avoid clashes with older versions of react-resizable-panels which have been saved in local storage.
+const transformLayoutKey = (key: string) =>
+ key.replace('react-resizable-panels:', 'react-resizable-panels-v4:')
+
+const serverCompatibleLocalStorage = {
+ getItem: (k: string) => {
+ if (typeof window === 'undefined') return null
+ const key = transformLayoutKey(k)
+ return localStorage.getItem(key)
+ },
+ setItem: (k: string, value: string) => {
+ if (typeof window === 'undefined') return
+ const key = transformLayoutKey(k)
+ localStorage.setItem(key, value)
+ },
+}
+
+const ResizablePanelGroupWithPersistence = ({
+ className,
+ autoSaveId,
+ defaultLayout: defaultLayoutProp,
+ onLayoutChanged: onLayoutChangedProp,
+ ...props
+}: ResizablePrimitive.GroupProps & { autoSaveId: string }) => {
+ const { defaultLayout, onLayoutChanged } = useDefaultLayout({
+ id: autoSaveId,
+ storage: serverCompatibleLocalStorage,
+ })
+
+ return (
+ <ResizablePrimitive.Group
+ defaultLayout={defaultLayoutProp ?? defaultLayout}
+ onLayoutChanged={onLayoutChangedProp ?? onLayoutChanged}
+ className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}
+ data-slot="resizable-panel-group"
+ {...props}
+ />
+ )
+}
+
const ResizablePanelGroup = ({
className,
+ autoSaveId,
...props
-}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
- <ResizablePrimitive.PanelGroup
- className={cn('flex h-full w-full data-[panel-group-direction=vertical]:flex-col', className)}
- {...props}
- />
-)
+}: ResizablePrimitive.GroupProps & { autoSaveId?: string }) => {
+ if (autoSaveId) {
+ return (
+ <ResizablePanelGroupWithPersistence
+ autoSaveId={autoSaveId}
+ className={className}
+ {...props}
+ />
+ )
+ }
+
+ return (
+ <ResizablePrimitive.Group
+ className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}
+ data-slot="resizable-panel-group"
+ {...props}
+ />
+ )
+}
-const ResizablePanel = ResizablePrimitive.Panel
+const ResizablePanel = ({ ...props }: ResizablePrimitive.PanelProps) => {
+ return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
+}
const ResizableHandle = ({
withHandle,
className,
...props
-}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
+}: ResizablePrimitive.SeparatorProps & {
withHandle?: boolean
-}) => (
- <ResizablePrimitive.PanelResizeHandle
- className={cn(
- 'relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90',
- 'data-[resize-handle-state=drag]:bg-border-strong',
- 'group',
- 'transition-colors',
- className
- )}
- {...props}
- >
- {withHandle && (
- <div
- className={cn(
- 'z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border focus:bg-surface-400',
- 'opacity-0 transition-opacity duration-200',
- 'group-data-[resize-handle-state=hover]:opacity-100',
- 'hover:bg-surface-400',
- 'group-data-[resize-handle-state=drag]:opacity-100',
- 'group-data-[resize-handle-state=drag]:bg-foreground-muted'
- )}
- >
- <GripVertical className="h-2.5 w-2.5" />
- </div>
- )}
- </ResizablePrimitive.PanelResizeHandle>
-)
-
-export { ResizableHandle, ResizablePanel, ResizablePanelGroup, type ImperativePanelHandle }
+}) => {
+ return (
+ <ResizablePrimitive.Separator
+ className={cn(
+ 'relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90',
+ 'data-[separator=active]:bg-border-strong',
+ 'group',
+ 'transition-colors',
+ className
+ )}
+ style={{ cursor: 'auto' }}
+ {...props}
+ >
+ {withHandle && (
+ <div
+ className={cn(
+ 'z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border focus:bg-surface-400',
+ 'opacity-0 transition-opacity duration-200',
+ 'group-data-[separator=hover]:opacity-100',
+ 'hover:bg-surface-400',
+ 'group-data-[separator=active]:opacity-100',
+ 'group-data-[separator=active]:bg-foreground-muted'
+ )}
+ >
+ <GripVertical className="h-2.5 w-2.5" />
+ </div>
+ )}
+ </ResizablePrimitive.Separator>
+ )
+}
+
+const useDefaultLayout = ResizablePrimitive.useDefaultLayout
+const usePanelRef = ResizablePrimitive.usePanelRef
+
+export { ResizableHandle, ResizablePanel, ResizablePanelGroup, useDefaultLayout, usePanelRef }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 83120c44bc3..34115f22655 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2481,8 +2481,8 @@ importers:
specifier: ^5.2.4
react-resizable-panels:
- specifier: ^3.0.0
+ specifier: ^4.6.5
react-syntax-highlighter:
specifier: ^15.6.6
version: 15.6.6([email protected])
@@ -16019,11 +16019,11 @@ packages:
'@types/react':
optional: true
- resolution: {integrity: sha512-b3qKHQ3MLqOgSS+FRYKapNkJZf5EQzuf6+RLiq1/IlTHw99YrZ2NJZLk4hQIzTnnIkRg2LUqyVinu6YWWpUYew==}
+ resolution: {integrity: sha512-pmQP6qv9KmsesNMvWVNvVfVJAwYSOWWbAOAtrPR8Cre20+j1NWIlyft0btjtDQE+OepXmI6g3VPrCXQY0oD7+Q==}
peerDependencies:
- react: ^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
- react-dom: ^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
+ react: ^18.0.0 || ^19.0.0
+ react-dom: ^18.0.0 || ^19.0.0
resolution: {integrity: sha512-vKpeHhI5OZvYn82kXOs1bC8aOXktGU5AmKAgaZS4F5JPburCtbmDPqE7Pzp+1kN4+Wb81LlF33VpGwWwtXem+w==}
@@ -35071,7 +35071,7 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
dependencies:
react: 18.3.1
react-dom: 18.3.1([email protected])
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index aa4e736d669..ff4ee79cb1e 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -59,6 +59,7 @@ minimumReleaseAgeExclude:
- lodash-es
- lodash
- next-mdx-remote
+ - react-resizable-panels
onlyBuiltDependencies:
- supabase