fix: [재고목록] 플로팅 메뉴 클릭 즉시 닫힘 수정 (이벤트 전파 방지)

This commit is contained in:
김보곤
2026-03-22 12:33:00 +09:00
parent f1651f31e8
commit a2bf91e27d

View File

@@ -161,6 +161,7 @@ export function StockStatusList() {
const [usageLoading, setUsageLoading] = useState(false);
const handleRowClick = (item: StockItem, e?: React.MouseEvent) => {
e?.stopPropagation();
if (actionMenu?.item.id === item.id) {
setActionMenu(null);
return;
@@ -174,8 +175,10 @@ export function StockStatusList() {
useEffect(() => {
if (!actionMenu) return;
const close = () => setActionMenu(null);
window.addEventListener('click', close, { once: true });
return () => window.removeEventListener('click', close);
const timer = setTimeout(() => {
window.addEventListener('click', close, { once: true });
}, 0);
return () => { clearTimeout(timer); window.removeEventListener('click', close); };
}, [actionMenu]);
const handleViewUsage = async (item: StockItem) => {