Skip to content

Commit b3ae27f

Browse files
committed
fix
1 parent ccf4c25 commit b3ae27f

File tree

1 file changed

+21
-29
lines changed
  • apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table

1 file changed

+21
-29
lines changed

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
3+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
44
import { useParams, useRouter } from 'next/navigation'
55
import { usePostHog } from 'posthog-js/react'
66
import {
@@ -2905,7 +2905,7 @@ const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
29052905
}) {
29062906
const renameInputRef = useRef<HTMLInputElement>(null)
29072907

2908-
useLayoutEffect(() => {
2908+
useEffect(() => {
29092909
if (isRenaming && renameInputRef.current) {
29102910
renameInputRef.current.focus()
29112911
renameInputRef.current.select()
@@ -2958,6 +2958,7 @@ const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
29582958
const handleThPointerDown = useCallback(
29592959
(e: React.PointerEvent) => {
29602960
if (isRenaming || e.button !== 0) return
2961+
if ((e.target as HTMLElement).closest('button')) return
29612962
e.preventDefault()
29622963

29632964
const th = e.currentTarget as HTMLElement
@@ -3041,36 +3042,27 @@ const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
30413042
)}
30423043
</div>
30433044
) : (
3044-
<div className='flex h-full w-full min-w-0 items-center px-2 py-[7px]'>
3045-
<ColumnTypeIcon type={column.type} />
3046-
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[var(--text-primary)] text-small'>
3047-
{column.name}
3048-
</span>
3049-
{sortDirection && (
3050-
<span className='ml-1 shrink-0'>
3051-
<SortDirectionIndicator direction={sortDirection} />
3052-
</span>
3053-
)}
3054-
<button
3055-
type='button'
3056-
onPointerDown={(e) => e.stopPropagation()}
3057-
onClick={() => {
3058-
onColumnSelect?.(colIndex, false)
3059-
setMenuOpen((o) => !o)
3060-
}}
3061-
className='ml-1 flex shrink-0 cursor-pointer items-center opacity-0 outline-none transition-opacity group-hover:opacity-100'
3062-
>
3063-
<ChevronDown className='h-[7px] w-[9px] text-[var(--text-muted)]' />
3064-
</button>
3045+
<div className='flex h-full w-full min-w-0 items-center'>
30653046
<DropdownMenu open={menuOpen} onOpenChange={setMenuOpen}>
30663047
<DropdownMenuTrigger asChild>
3067-
<div className='pointer-events-none absolute inset-0' />
3048+
<button
3049+
type='button'
3050+
onClick={(e) => onColumnSelect?.(colIndex, e.shiftKey)}
3051+
className='flex min-w-0 flex-1 cursor-pointer items-center px-2 py-[7px] outline-none'
3052+
>
3053+
<ColumnTypeIcon type={column.type} />
3054+
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[var(--text-primary)] text-small'>
3055+
{column.name}
3056+
</span>
3057+
{sortDirection && (
3058+
<span className='ml-1 shrink-0'>
3059+
<SortDirectionIndicator direction={sortDirection} />
3060+
</span>
3061+
)}
3062+
<ChevronDown className='ml-1 h-[7px] w-[9px] shrink-0 text-[var(--text-muted)] opacity-0 transition-opacity group-hover:opacity-100' />
3063+
</button>
30683064
</DropdownMenuTrigger>
3069-
<DropdownMenuContent
3070-
align='start'
3071-
sideOffset={0}
3072-
onCloseAutoFocus={(e) => e.preventDefault()}
3073-
>
3065+
<DropdownMenuContent align='start' sideOffset={0}>
30743066
<DropdownMenuItem onSelect={() => onSortAsc?.(column.name)}>
30753067
<ArrowUp />
30763068
Sort ascending

0 commit comments

Comments
 (0)