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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user