From 942f0a06487166ba96c236c83770ad802419e361 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Wed, 21 Aug 2024 11:12:25 +0200 Subject: [PATCH] fix note not loading when both `id` and `map` hash parameters are set --- CHANGELOG.md | 6 ++++++ modules/core/context.js | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b7a13cd1..bbf914514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,12 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :hammer: Development +# 2.30.1 +##### 2024-Aug-21 + +* Fix note not loading when iD is started with both an `id=note/123` and `map=…` hash parameter + + # 2.30.0 ##### 2024-Aug-21 diff --git a/modules/core/context.js b/modules/core/context.js index 8e6fdd655..c49245af7 100644 --- a/modules/core/context.js +++ b/modules/core/context.js @@ -222,17 +222,18 @@ export function coreContext() { context.zoomToNote = (noteId, zoomTo) => { context.loadNote(noteId, (err, result) => { if (err) return; - if (zoomTo === false) return; const entity = result.data.find(e => e.id === noteId); if (entity) { - // zoom to, used note loc - const note = services.osm.getNote(noteId); + // zoom to, used note loc + const note = services.osm.getNote(noteId); + if (zoomTo !== false) { context.map().centerZoom(note.loc,15); - // open note layer - const noteLayer = context.layers().layer('notes'); - noteLayer.enabled(true); - // select the note - context.enter(modeSelectNote(context, noteId)); + } + // open note layer + const noteLayer = context.layers().layer('notes'); + noteLayer.enabled(true); + // select the note + context.enter(modeSelectNote(context, noteId)); } }); };