Clean up build errors
This commit is contained in:
@@ -203,7 +203,7 @@ export function QuickOrderBuilder({
|
||||
const [showExcludedOnly, setShowExcludedOnly] = useState<boolean>(false);
|
||||
const [parsed, setParsed] = useState<boolean>(false);
|
||||
const [showMapping, setShowMapping] = useState<boolean>(false);
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const [, startTransition] = useTransition();
|
||||
const [initialCategories, setInitialCategories] = useState<CategorySummary[] | null>(null);
|
||||
|
||||
// Local storage draft persistence
|
||||
|
||||
@@ -303,7 +303,7 @@ const ValidationCell = React.memo(({
|
||||
copyDown,
|
||||
rowIndex,
|
||||
totalRows = 0,
|
||||
editingCells,
|
||||
// editingCells not used; keep setEditingCells for API compatibility
|
||||
setEditingCells
|
||||
}: ValidationCellProps) => {
|
||||
// Use the CopyDown context
|
||||
|
||||
@@ -564,7 +564,7 @@ const ValidationContainer = <T extends string>({
|
||||
// Handle supplier + UPC validation - using the most recent values
|
||||
if (key === 'supplier' && value) {
|
||||
// Get the latest UPC value from the updated row
|
||||
const upcValue = updatedRow.upc || updatedRow.barcode;
|
||||
const upcValue = (data[rowIndex] as any)?.upc || (data[rowIndex] as any)?.barcode;
|
||||
|
||||
if (upcValue) {
|
||||
console.log(`Validating UPC: rowIndex=${rowIndex}, supplier=${value}, upc=${upcValue}`);
|
||||
@@ -661,7 +661,7 @@ const ValidationContainer = <T extends string>({
|
||||
// Handle UPC/barcode + supplier validation
|
||||
if ((key === 'upc' || key === 'barcode') && value) {
|
||||
// Get latest supplier from the updated row
|
||||
const supplier = updatedRow.supplier;
|
||||
const supplier = (data[rowIndex] as any)?.supplier;
|
||||
|
||||
if (supplier) {
|
||||
console.log(`Validating UPC from UPC change: rowIndex=${rowIndex}, supplier=${supplier}, upc=${value}`);
|
||||
|
||||
@@ -25,7 +25,8 @@ type ErrorType = {
|
||||
}
|
||||
|
||||
// Stable empty errors array to prevent unnecessary re-renders
|
||||
const EMPTY_ERRORS: ErrorType[] = Object.freeze([]);
|
||||
// Use a mutable empty array to satisfy the ErrorType[] type
|
||||
const EMPTY_ERRORS: ErrorType[] = [];
|
||||
|
||||
interface ValidationTableProps<T extends string> {
|
||||
data: RowData<T>[]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback, useTransition, useRef, useEffect, useMemo } from 'react'
|
||||
import React, { useState, useCallback, useMemo } from 'react'
|
||||
import { Field } from '../../../../types'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -17,27 +17,7 @@ interface InputCellProps<T extends string> {
|
||||
className?: string
|
||||
}
|
||||
|
||||
// Add efficient price formatting utility with null safety
|
||||
const formatPrice = (value: any): string => {
|
||||
// Handle undefined, null, or non-string values
|
||||
if (value === undefined || value === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Convert to string if not already
|
||||
const stringValue = String(value);
|
||||
|
||||
// Remove any non-numeric characters except decimal point
|
||||
const numericValue = stringValue.replace(/[^\d.]/g, '');
|
||||
|
||||
// Parse as float and format to 2 decimal places
|
||||
const numValue = parseFloat(numericValue);
|
||||
if (!isNaN(numValue)) {
|
||||
return numValue.toFixed(2);
|
||||
}
|
||||
|
||||
return numericValue;
|
||||
};
|
||||
// (removed unused formatPrice helper)
|
||||
|
||||
const InputCell = <T extends string>({
|
||||
field,
|
||||
|
||||
@@ -84,8 +84,6 @@ export const useRowOperations = <T extends string>(
|
||||
if (rowsWithUniqueErrors.has(rowIdx)) return;
|
||||
|
||||
if ((rowErrs as any)[fieldKey]) {
|
||||
// Also clear uniqueness errors when the current value is empty
|
||||
const currentValue = (dataForCalc[rowIdx] as any)?.[fieldKey];
|
||||
const filtered = (rowErrs as any)[fieldKey].filter((e: ValidationError) => e.type !== ErrorType.Unique);
|
||||
if (filtered.length > 0) (rowErrs as any)[fieldKey] = filtered;
|
||||
else delete (rowErrs as any)[fieldKey];
|
||||
|
||||
@@ -142,7 +142,7 @@ export const useValidationState = <T extends string>({
|
||||
const hasEditingCells = editingCells.size > 0;
|
||||
|
||||
const initialValidationDoneRef = useRef(false);
|
||||
const isValidatingRef = useRef(false);
|
||||
// isValidatingRef unused; remove to satisfy TS
|
||||
// Track last seen item_number signature to drive targeted uniqueness checks
|
||||
const lastItemNumberSigRef = useRef<string | null>(null);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ interface SearchResult {
|
||||
}
|
||||
|
||||
export function Chat() {
|
||||
const { user: currentUser, token } = useContext(AuthContext);
|
||||
const { user: currentUser } = useContext(AuthContext);
|
||||
const [users, setUsers] = useState<User[]>([]);
|
||||
const [selectedUserId, setSelectedUserId] = useState<string>('');
|
||||
const [selectedRoomId, setSelectedRoomId] = useState<string | null>(null);
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user