Fix browser refresh corner cases in multi-map lazy init (issue #1384)#1607
Fix browser refresh corner cases in multi-map lazy init (issue #1384)#1607jumpinjackie merged 4 commits intomasterfrom
Conversation
…1384) Co-authored-by: jumpinjackie <563860+jumpinjackie@users.noreply.github.com>
|
@copilot There is another corner case cropping up. I have an appdef with 3 maps.
The corner case crops up as follows:
Expect: I get Redding's map again. |
…ct map on refresh Co-authored-by: jumpinjackie <563860+jumpinjackie@users.noreply.github.com>
The root cause was that the previous fix always deferred non-first (by appdef position) maps to Fixed in b62a7d0: Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|

After a browser refresh with a reused session, switching to maps that were never previously visited would trigger a blind
DESCRIBERUNTIMEMAPfor those maps — which fails because they were never created on the server in the previous session. A second corner case also existed where refreshing while a non-first map (e.g., Redding in a 3-map layout) was active would result in a blank "Loading..." screen.Root Cause
canLazyLoadwas gated on!sessionWasReused, so on refresh all maps were eagerly pushed throughtryDescribeRuntimeMapAsyncduring init — including never-visited ones that don't exist in the session yet.A second bug existed in the deferred-map routing: it always treated the first map by appdef position as the primary map to recover, rather than the map the user was actually viewing. With Redding (map 2) active at refresh time, Redding was deferred to
pendingMapDefsand the app had noruntimeMapfor the active map, causing the blank screen.Changes
src/actions/init-mapguide.ts: Drop!sessionWasReusedfromcanLazyLoad. Reorder the routing sopendingMapDefsdeferral takes priority. UseinitialActiveMap(from the?map=URL param) to identify which map to eagerly recover on refresh — not just the first-by-position. Falls back to first-by-position ifinitialActiveMapis absent or doesn't match any map in the appdef.src/actions/map.ts(activateMap): Switch from always callingcreateRuntimeMapto a describe-first, create-on-not-found pattern. Handles both the reused-session case (map already exists → DESCRIBE succeeds) and the never-visited case (DESCRIBE fails withMgResourceNotFoundException→ fall back to CREATE).test/actions/map.spec.ts: Add three newactivateMaptests covering: DESCRIBE success, DESCRIBE→CREATE fallback onMgResourceNotFoundException, and graceful degradation on other errors.📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.