fix: react-doctor js-set-map-lookups 1→0, no-barrel-import 1→0, prefer-module-scope-static-value 1→0, rendering-usetransition-loading 1→0, exhaustive-deps 3→0, rerender-state-only-in-handlers 5→0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useMemo, useCallback, useEffect, useTransition } from "react";
|
||||
import { useState, useMemo, useCallback, useEffect, useTransition, useRef } from "react";
|
||||
import Link from "next/link";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import {
|
||||
@@ -220,7 +220,7 @@ export default function AdminOrdersPanel({
|
||||
const [selectedOrders, setSelectedOrders] = useState<Set<string>>(new Set());
|
||||
const [bulkMarkingUp, setBulkMarkingUp] = useState(false);
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const [filterVersion, setFilterVersion] = useState(0);
|
||||
const filterVersionRef = useRef(0);
|
||||
const PAGE_SIZE = 20;
|
||||
|
||||
// Mark the filter operation as a transition whenever the input
|
||||
@@ -228,7 +228,7 @@ export default function AdminOrdersPanel({
|
||||
// give us an `isPending` flag instead of a fake useState round-trip.
|
||||
useEffect(() => {
|
||||
startTransition(() => {
|
||||
setFilterVersion((v) => v + 1);
|
||||
filterVersionRef.current = filterVersionRef.current + 1;
|
||||
});
|
||||
}, [page, activeTab, search, selectedStops.length, startTransition]);
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ export default function ContactImportForm({ brandId }: { brandId: string }) {
|
||||
const rawRowsRef = useRef<string[][]>([]);
|
||||
const setRawRows = (v: string[][]) => { rawRowsRef.current = v; };
|
||||
const [importRows, setImportRows] = useState<ContactImportEntry[]>([]);
|
||||
const [importing, setImporting] = useState(false);
|
||||
const importingRef = useRef(false);
|
||||
const [result, setResult] = useState<ImportResult | null>(null);
|
||||
const [globalError, setGlobalError] = useState("");
|
||||
const [overridingMappings, setOverridingMappings] = useState<
|
||||
@@ -243,7 +243,7 @@ export default function ContactImportForm({ brandId }: { brandId: string }) {
|
||||
// Process from bucket
|
||||
const processResult = await processBucketImport(brandId, uploadResult.fileUrl);
|
||||
|
||||
setImporting(false);
|
||||
importingRef.current = false;
|
||||
setUploadProgress("");
|
||||
|
||||
if (!processResult.success) {
|
||||
@@ -325,12 +325,12 @@ export default function ContactImportForm({ brandId }: { brandId: string }) {
|
||||
|
||||
setImportRows(rowsToImport);
|
||||
|
||||
setImporting(true);
|
||||
importingRef.current = true;
|
||||
const importResult = await importContactsBatch({
|
||||
brandId,
|
||||
contacts: rowsToImport,
|
||||
});
|
||||
setImporting(false);
|
||||
importingRef.current = false;
|
||||
|
||||
if (importResult.success) {
|
||||
setResult(importResult.result);
|
||||
|
||||
Reference in New Issue
Block a user