Language and logout bug
Some checks failed
CI / Check (push) Failing after 6m56s
Build and publish Docker image / build-and-push (push) Successful in 7m26s

This commit is contained in:
Andras Schmelczer 2026-06-27 10:45:48 +01:00
parent f047e50989
commit f1601257c7
12 changed files with 287 additions and 122 deletions

View file

@ -106,6 +106,7 @@ export default function MapPage({
initialTravelTime,
initialPostcode,
shareCode,
onSessionRejected,
user,
onLoginClick,
onRegisterClick,
@ -293,6 +294,7 @@ export default function MapPage({
filterRange,
travelTimeEntries: entries,
shareCode,
onSessionRejected,
});
// Read the zoom through a ref inside handleAiFilterSubmit so panning/zooming
@ -765,6 +767,20 @@ export default function MapPage({
}
}, [filtersUnlimited, lockFilterAdds, effectiveFilterCap, filters, entries]);
// When the cap tightens (logout / session invalidated / license lapse), useFilters
// re-clamps the feature filters, but travel-time entries — which count toward the same
// server cap — live here. Trim them to the cap too so the combined request can't exceed
// it and blank the map. Read via ref so this only fires on a cap change, not on every
// travel edit (those are already gated by handleAddTravelTimeEntry).
const entriesRef = useRef(entries);
entriesRef.current = entries;
useEffect(() => {
if (filtersUnlimited) return;
if (entriesRef.current.length > effectiveFilterCap) {
handleSetEntries(entriesRef.current.slice(0, effectiveFilterCap));
}
}, [effectiveFilterCap, filtersUnlimited, handleSetEntries]);
const handleUpgradeClick = useCallback(() => {
onNavigateTo('pricing');
}, [onNavigateTo]);