fix
All checks were successful
Build And Deploy Main / build-and-deploy (push) Successful in 32s

This commit is contained in:
2026-03-09 16:19:11 -04:00
parent 91212ab759
commit 74ec3a0eda

View File

@@ -108,6 +108,15 @@ const RoutesDashboard = () => {
.trim();
};
// Match route addresses against stored structured addresses without state/zip sensitivity.
const normalizeAddressForMismatchCheck = (address) => {
return normalizeAddress(address)
.replace(/\b\d{5}(?:\s*\d{4})?\b/g, ' ')
.replace(/\b(maryland|md|virginia|va)\b/g, ' ')
.replace(/\s+/g, ' ')
.trim();
};
const formatStructuredAddress = (line1, line2, city, state, zipCode, note) => {
const cityState = [city, state].filter(Boolean).join(', ');
const mainAddress = [line1, line2, cityState, zipCode]
@@ -331,12 +340,12 @@ const RoutesDashboard = () => {
if (!customerProfile) return;
const routeAddress = customerInRoute?.customer_address_override || customerInRoute?.customer_address || '';
const normalizedRouteAddress = normalizeAddress(routeAddress);
const normalizedRouteAddress = normalizeAddressForMismatchCheck(routeAddress);
if (!normalizedRouteAddress) return;
const storedAddressSet = new Set(
getStoredCustomerAddresses(customerProfile)
.map((address) => normalizeAddress(address))
.map((address) => normalizeAddressForMismatchCheck(address))
.filter(Boolean)
);
if (storedAddressSet.size === 0) return;