fine 2
This commit is contained in:
parent
9e4e65fa2a
commit
ca771a7edf
32 changed files with 1467 additions and 109 deletions
|
|
@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
|
|||
import pb from '../lib/pocketbase';
|
||||
import { apiUrl, authHeaders } from '../lib/api';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { stripSelectedPostcodeParam } from '../lib/url-state';
|
||||
|
||||
export interface SavedSearch {
|
||||
id: string;
|
||||
|
|
@ -141,7 +142,11 @@ export function useSavedSearches(userId: string | null) {
|
|||
setSaving(true);
|
||||
setError(null);
|
||||
try {
|
||||
const params = paramsOverride ?? window.location.search.replace(/^\?/, '');
|
||||
// A saved search stores filter criteria, so drop the transient
|
||||
// selected-postcode param (a search/map-click leaves it in the URL).
|
||||
const params = stripSelectedPostcodeParam(
|
||||
paramsOverride ?? window.location.search.replace(/^\?/, '')
|
||||
);
|
||||
|
||||
// Create record immediately without screenshot
|
||||
const formData = new FormData();
|
||||
|
|
@ -220,11 +225,14 @@ export function useSavedSearches(userId: string | null) {
|
|||
);
|
||||
|
||||
const updateSearchParams = useCallback(
|
||||
async (id: string, params: string) => {
|
||||
async (id: string, rawParams: string) => {
|
||||
if (!userId) return;
|
||||
setSaving(true);
|
||||
setError(null);
|
||||
try {
|
||||
// Match saveSearch: a saved search never carries the transient
|
||||
// selected-postcode param.
|
||||
const params = stripSelectedPostcodeParam(rawParams);
|
||||
const record = await pb.collection('saved_searches').update(id, { params });
|
||||
trackEvent('Search Update');
|
||||
setSearches((prev) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue