fmt
All checks were successful
Build and publish Docker image / build-and-push (push) Successful in 2m2s
CI / Check (push) Successful in 8m38s

This commit is contained in:
Andras Schmelczer 2026-06-26 20:18:38 +01:00
parent 7bc591be2b
commit f03edb86c1
2 changed files with 38 additions and 3 deletions

View file

@ -695,6 +695,20 @@ export function useFilters({
// per-add path). Without this, an unlicensed user could end up with >5 filters,
// which the server then rejects (400), breaking the map.
let next = newFilters;
// On a shared link (lockAdds), a non-paying user may adjust the shared filters
// but not introduce new keys — enforce that on bulk sets too, not just in the
// per-add path, so the AI/bulk path can't be used to build a fresh set on a
// shared link. Keep only keys already present; signal if any were dropped.
if (lockAddsRef.current) {
const current = filtersRef.current;
const restricted = Object.fromEntries(
Object.entries(next).filter(([name]) => name in current)
);
if (Object.keys(restricted).length !== Object.keys(next).length) {
onFilterLimitReachedRef.current?.();
}
next = restricted;
}
const limit = filterLimitRef.current;
if (limit != null && Object.keys(next).length > limit) {
next = Object.fromEntries(Object.entries(next).slice(0, limit));