Fix store item variant defaults and listing sorting

Auto-select first option in variation modals and sort store items by availability, then update time.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-18 11:26:20 +03:30
co-authored by Cursor
parent b861ab3dc1
commit 5f4b0b4f92
20 changed files with 409 additions and 64 deletions
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from 'react'
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import {
Building2,
@@ -8,6 +8,7 @@ import {
Trash2,
UserRound,
} from 'lucide-react'
import { fitFixedPopover } from '../utils/fitFixedPopover'
import styles from './BusinessActionsOverflowMenu.module.css'
type PopoverPosition = {
@@ -52,10 +53,11 @@ export function DomainLinksOverflowMenu({ host, onRemove }: DomainLinksOverflowM
const rect = triggerRef.current?.getBoundingClientRect()
if (!rect) return
setPopoverPos({
top: rect.bottom + 8,
left: rect.right,
})
const size = popoverRef.current
? { width: popoverRef.current.offsetWidth, height: popoverRef.current.offsetHeight }
: { width: 220, height: 220 }
setPopoverPos(fitFixedPopover(rect, size, 'end'))
}
function toggleOpen() {
@@ -68,6 +70,11 @@ export function DomainLinksOverflowMenu({ host, onRemove }: DomainLinksOverflowM
setOpen(true)
}
useLayoutEffect(() => {
if (!open) return
updatePopoverPosition()
}, [open])
useEffect(() => {
if (!open) return