fix: react-doctor async-defer-await 10→0 (move await below guards), rerender-memo-with-default-value 13→0 (module-scope EMPTY_* defaults)
This commit is contained in:
@@ -15,6 +15,8 @@ const ENTITY_LABELS: Record<string, string> = {
|
||||
|
||||
const analysisLabels = ["Reading your file...", "AI is mapping columns...", "Cleaning and normalizing data...", "Finalizing preview..."];
|
||||
|
||||
const EMPTY_BRANDS: { id: string; name: string }[] = [];
|
||||
|
||||
const ALL_FIELDS = ["ignore", "product_name", "price", "description", "product_type", "active", "image_url",
|
||||
"customer_name", "customer_email", "customer_phone", "stop_id", "quantity", "fulfillment", "product_id",
|
||||
"first_name", "last_name", "full_name", "tags", "email_opt_in", "sms_opt_in", "external_id",
|
||||
@@ -29,7 +31,7 @@ type Props = {
|
||||
isPlatformAdmin?: boolean;
|
||||
};
|
||||
|
||||
export default function ImportCenterClient({ brandId: initialBrandId, brandName: initialBrandName, brands = [], isPlatformAdmin = false }: Props) {
|
||||
export default function ImportCenterClient({ brandId: initialBrandId, brandName: initialBrandName, brands = EMPTY_BRANDS, isPlatformAdmin = false }: Props) {
|
||||
const [activeBrandId, setActiveBrandId] = useState(initialBrandId);
|
||||
// Brand name is derived from the brands list — no separate state, so
|
||||
// updates to it don't trigger an extra render of the whole component.
|
||||
|
||||
@@ -357,7 +357,12 @@ function DashboardTab({ stats, recentOrders, brandId, onMsg, webhookActivity }:
|
||||
|
||||
// ── Customers Tab ────────────────────────────────────────────────────────────
|
||||
|
||||
function CustomersTab({ customers, products, brandId, onMsg, registrations = [], onRefresh }: {
|
||||
const EMPTY_REGISTRATIONS: Array<{
|
||||
id: string; company_name: string | null; contact_name: string | null;
|
||||
email: string; phone: string | null; account_status: string; created_at: string;
|
||||
}> = [];
|
||||
|
||||
function CustomersTab({ customers, products, brandId, onMsg, registrations = EMPTY_REGISTRATIONS, onRefresh }: {
|
||||
customers: WholesaleCustomer[];
|
||||
products: WholesaleProduct[];
|
||||
brandId: string;
|
||||
|
||||
Reference in New Issue
Block a user