Fix horizontal scrolling in table editor when no rows present (#35526)

This commit is contained in:
Joshen Lim authored and GitHub committed 2025-05-07 15:11:05 -02:30
1 parent 77d99e0f04
commit 656a2dcbd8
1 file changed
+9 -4
@@ -1,4 +1,4 @@
import { forwardRef, memo, useRef } from 'react'
import { forwardRef, memo, Ref, useRef } from 'react'
import DataGrid, { CalculatedColumn, DataGridHandle } from 'react-data-grid'
import { handleCopyCell } from 'components/grid/SupabaseGrid.utils'
@@ -48,7 +48,7 @@ export const Grid = memo(
filters,
onApplyFilters,
},
ref: React.Ref<DataGridHandle> | undefined
ref: Ref<DataGridHandle> | undefined
) => {
const tableEditorSnap = useTableEditorStateSnapshot()
const snap = useTableEditorTableStateSnapshot()
@@ -119,7 +119,7 @@ export const Grid = memo(
{(rows ?? []).length === 0 && (
<div
style={{ height: `calc(100% - 35px)` }}
className="absolute top-9 z-[2] p-2 w-full"
className="absolute top-9 p-2 w-full z-[1] pointer-events-none"
>
{isLoading && <GenericSkeletonLoader />}
{isError && (
@@ -144,6 +144,7 @@ export const Grid = memo(
{
<Button
type="default"
className="pointer-events-auto"
onClick={() => {
tableEditorSnap.onImportData()
sendEvent({
@@ -167,7 +168,11 @@ export const Grid = memo(
The filters applied have returned no results from this table
</p>
<div className="flex items-center space-x-2 mt-4">
<Button type="default" onClick={() => removeAllFilters()}>
<Button
type="default"
className="pointer-events-auto"
onClick={() => removeAllFilters()}
>
Remove all filters
</Button>
</div>