fmt
This commit is contained in:
parent
7bc591be2b
commit
f03edb86c1
2 changed files with 38 additions and 3 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue