Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions src/utils/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,23 @@ export function deserializeFiltersFromObject(
continue;
}

// Split comma-separated values and convert to array of objects
const values = v.split(",").map((val) => ({
label: val.trim(),
value: val.trim(),
}));
// If the value is a JSON object/array (e.g. geometry), keep it as-is.
// Otherwise split comma-separated string values.
let parsed: any;
try {
parsed = JSON.parse(v);
} catch {
parsed = undefined;
}

result[k] = values;
if (parsed !== undefined && typeof parsed === "object") {
result[k] = [{ label: parsed, value: parsed }];
} else {
result[k] = v.split(",").map((val) => ({
label: val.trim(),
value: val.trim(),
}));
}
}

return result;
Expand Down Expand Up @@ -157,7 +167,7 @@ export function serializeFiltersToQuery(filters: any): string {

const filterJoined = v
.filter((x) => !!x && typeof x === "object" && x.value !== "")
.map((x) => String(x.value))
.map((x) => getString(x.value))
.join(",");

if (filterJoined === "") continue;
Expand Down