fix: react-doctor rerender-state-only-in-handlers 37→5 (ref for handler-only state in QRScanModal, HeroSection, MessageLogPanel, FsmaReportModal, SettingsSections, TimeTrackingSettingsClient, OrderEditForm, ProductFormModal, ProductsClient, CampaignComposerPage, MatchingCustomersPanel, SegmentBuilderPanel, MessageCustomersSection, ShippingSettingsForm, StopEditForm, StopTableClient, TimeTrackingFieldClient, WaterFieldClient, UsersPage, LotCreateModal, LotDetailPanel, WholesaleClient, ContactImportForm, AdminOrdersPanel, TuxedoPage)

This commit is contained in:
Nora
2026-06-26 07:10:42 -06:00
parent ce2dc8f070
commit ad0a0fe4ec
20 changed files with 161 additions and 181 deletions
@@ -181,9 +181,8 @@ export default function FsmaReportModal({ brandId }: { brandId: string }) {
// Track the most recent fetch signature so the effect below can
// request fresh data when the user changes the date range or hits
// the refresh button.
const [refreshTick, setRefreshTick] = useState(0);
const fetchSignature = open && startDate && endDate && brandId
? `${brandId}|${startDate}|${endDate}|${refreshTick}`
? `${brandId}|${startDate}|${endDate}`
: null;
// Kicks off a fetch and writes the result into state. Stable enough
@@ -226,7 +225,10 @@ export default function FsmaReportModal({ brandId }: { brandId: string }) {
}, [fetchSignature, performFetch]);
function fetchComplianceData() {
setRefreshTick((n) => n + 1);
// Inline the same logic as the effect above — performFetch with a
// fresh cancellation signal.
const signal = { cancelled: false };
void performFetch(signal);
}
function handleDownload() {