fix(render_map_tool): apply baseStyle changes on render, not just construction - #261
Merged
Merged
Conversation
…struction baseStyle was only ever read at map-construction time from a server-embedded #initial-data script tag, but MapAppUIResource never actually seeds that tag -- so the map always constructs with the default "standard" style, and the real payload (with baseStyle) arrives later via the tool-result -> render() path, which never touched baseStyle at all. Caught live: a "standard-satellite" request rendered a map labeled "satellite view" that was still the standard vector style. render() now detects a baseStyle change and switches via map.setStyle(...), deferring the rest of the render until style.load fires. Added regression tests, confirmed to fail without the fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
OX Security reviewed this pull request — nothing to fix.
Branch |
Valiunia
approved these changes
Sep 17, 2026
zmofei
approved these changes
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
render_map_tool'sbaseStyle(e.g."standard-satellite") was silently ignored on every real call. It was only ever applied at map-construction time from a server-embedded#initial-datascript tag, butMapAppUIResourcenever actually passesinitialDatawhen serving the map HTML — so that tag is always empty, the map always constructs with the default"standard"style, and the real payload (withbaseStyle) arrives later via theui/notifications/tool-result→render(payload)path, which never handledbaseStyleat all (onlybaseMapConfigcolor/theme properties).baseStyle: "standard-satellite"render produced a map correctly labeled "satellite view" that was still the standard vector style underneath.render()now detects whenpayload.baseStylediffers from the style the map is currently on and switches viamap.setStyle(...), deferring the rest of the render (layers/markers/camera/etc.) untilstyle.loadfires — matching how a style swap normally works in GL JS, since it replaces sources/layers.Test plan
baseStylearriving via a tool-result render, not initial data — the actual real-world path) — confirmed it fails without the fix (git stashthe source change, rerun, seesetStyleCallscome back empty)setStyleis not called when a render repeats the already-active style (no-op case)npx vitest run— full suite, 947 tests passnpx tsc --noEmit— clean🤖 Generated with Claude Code