From d5da45eacb254137f78d0b935206c1f4aee1cfe9 Mon Sep 17 00:00:00 2001 From: Said Turksever Date: Mon, 28 Sep 2026 22:12:46 +0100 Subject: [PATCH] fix(street-level): record filter and provider changes in share links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The panel changed the imagery filter and provider switches by calling the layer directly, which bypasses the data manager's params request, the only path saved state and share links record. A link copied after picking 360° or a SINCE window came back with the defaults. The controls now send those changes through dataManager.setLayerParams('street-level', ..., { origin: 'user' }), as the CCTV panel does; the layer applies them through its own setParams. The feature gate's 360° step now asserts the share hash carries `0.p.p`; it times out on the previous controls. Co-Authored-By: Claude Opus 5.5 --- scripts/qa-street-level.mjs | 9 +++++++++ src/ui/applicationShell.js | 2 ++ src/ui/streetLevelControls.js | 19 +++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/scripts/qa-street-level.mjs b/scripts/qa-street-level.mjs index 83351bfc7..73de9c7c9 100644 --- a/scripts/qa-street-level.mjs +++ b/scripts/qa-street-level.mjs @@ -330,6 +330,15 @@ async function main() { const after = (await ui()).coverage.count; assert.ok(after <= before, `${after} ≤ ${before}`); assert.equal((await ui()).filter.pano, 'pano'); + // The click is a user params request, so the share link records it + // (Street Level's share token is `0`). + await page.waitForFunction( + () => + /(^|_)0\.p\.p(_|$)/.test( + new URLSearchParams(location.hash.slice(1)).get('lo') || '', + ), + { timeout: 10_000 }, + ); await page.click('[data-sl-pano="all"]'); await sleep(600); assert.equal((await ui()).coverage.count, before); diff --git a/src/ui/applicationShell.js b/src/ui/applicationShell.js index 96ab01e3b..5dd05030d 100644 --- a/src/ui/applicationShell.js +++ b/src/ui/applicationShell.js @@ -948,6 +948,8 @@ export class StyleManager extends ShellFacade { this._dataManager?.setEnabled('street-level', enabled, { origin: 'user', }), + setParams: (params, options) => + this._dataManager?.setLayerParams('street-level', params, options), setPanelCollapsed: (collapsed, options) => this.setPanelCollapsed('street-level-panel', collapsed, options), dockPanel: () => this._panelChrome.dockPanel('street-level-panel'), diff --git a/src/ui/streetLevelControls.js b/src/ui/streetLevelControls.js index d42cb2ed7..39a6a4b53 100644 --- a/src/ui/streetLevelControls.js +++ b/src/ui/streetLevelControls.js @@ -80,7 +80,7 @@ export class StreetLevelControls { }); for (const button of this.root.querySelectorAll('[data-sl-pano]')) { this.listen(button, 'click', () => - this.layer.setCoverageFilter?.({ pano: button.dataset.slPano }), + this._setParams({ pano: button.dataset.slPano }), ); } // The readout follows the thumb; coverage is rebuilt once, on release. @@ -92,7 +92,7 @@ export class StreetLevelControls { el.sinceRange.setAttribute('aria-valuetext', label); }); this.listen(el.sinceRange, 'change', () => - this.layer.setCoverageFilter?.({ sinceDays: sinceDays() }), + this._setParams({ sinceDays: sinceDays() }), ); this.listen(el.followBtn, 'click', () => { this.layer.setFollow?.(!(this._state?.street?.follow === true)); @@ -160,6 +160,17 @@ export class StreetLevelControls { } } + /** + * Filter and provider changes go through the data manager as a user params + * request, so saved state and share links record them; the layer applies + * them through its own `setParams`. + */ + _setParams(params) { + if (this.actions.setParams) + this.actions.setParams(params, { origin: 'user' }); + else this.layer.setParams?.(params); + } + /** * A provider chip is the layer's switch: lighting one turns the layer on * with that provider; darkening the last lit one turns the layer off (the @@ -169,7 +180,7 @@ export class StreetLevelControls { const chip = this._view?.providers.find((entry) => entry.id === providerId); if (!chip) return; if (!chip.active) { - this.layer.setProviderEnabled?.(providerId, true); + this._setParams({ [providerId]: true }); await this._ensureEnabled(); return; } @@ -177,7 +188,7 @@ export class StreetLevelControls { (entry) => entry.id !== providerId && entry.active, ); if (othersLit) { - this.layer.setProviderEnabled?.(providerId, false); + this._setParams({ [providerId]: false }); return; } try {