fine 2
This commit is contained in:
parent
9e4e65fa2a
commit
ca771a7edf
32 changed files with 1467 additions and 109 deletions
|
|
@ -92,6 +92,23 @@ const CRIME_TYPES_NONE_PARAM = '__none';
|
|||
const OVERLAY_NONE_PARAM = '__none';
|
||||
const CRIME_OVERLAY_ID: OverlayId = 'crime-hotspots';
|
||||
|
||||
/** URL param holding the currently focused postcode (from a search or a map
|
||||
* click). It reflects a transient selection, not search criteria, so a live or
|
||||
* shared link keeps it but a saved search must not bake it in. */
|
||||
export const SELECTED_POSTCODE_PARAM = 'pc';
|
||||
|
||||
/**
|
||||
* Drop the transient selected-postcode param from a serialized query string so a
|
||||
* saved search captures the filter criteria, not whichever postcode the user
|
||||
* last clicked. Takes and returns a query string without the leading '?'.
|
||||
*/
|
||||
export function stripSelectedPostcodeParam(params: string): string {
|
||||
const parsed = new URLSearchParams(params);
|
||||
if (!parsed.has(SELECTED_POSTCODE_PARAM)) return params;
|
||||
parsed.delete(SELECTED_POSTCODE_PARAM);
|
||||
return parsed.toString();
|
||||
}
|
||||
|
||||
export interface UrlState {
|
||||
viewState: ViewState;
|
||||
/** True only when the URL carried explicit lat/lon/zoom (shared/dashboard link).
|
||||
|
|
@ -406,7 +423,7 @@ export function parseUrlState(): UrlState {
|
|||
|
||||
// Selected postcode. This is also accepted as the historical one-time
|
||||
// navigate-to-postcode param used by saved-property links.
|
||||
const pc = params.get('pc');
|
||||
const pc = params.get(SELECTED_POSTCODE_PARAM);
|
||||
if (pc) {
|
||||
result.postcode = pc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue