Adds some extra WME functionality related to Google place links.
Seznam verzí skriptu, při kterých došlo ke změnám v kódu. Zobrazit všechny verze.
Guard #onWmeSelectionChanged against unsupported SDK selection typesWaze recently added Google Places as a clickable layer in WME. When a Google Place is selected, sdk.Editing.getSelection() throws WMEError: Selection contains an unexpected object type googlePlace because googlePlace is defined in ObjectType but is not in the SDK's SELECTABLE_OBJECT_TYPES list.The wme-selection-changed event fires for all selection changes (including Google Places), but since the event payload is always undefined, there is no way to pre-screen the type before calling getSelection(). The only reliable guard is a try/catch.SDKGoogleLinkEnhancer only operates on venue selections, so returning early on any unsupported type is the correct behavior — nothing is lost.Before: #onWmeSelectionChanged called this.sdk.Editing.getSelection() unguarded, throwing an unhandled exception on every Google Place click.After: The call is wrapped in try/catch; on error the handler returns silently.
The SDK version was making significantly more Google API requests than the original script. With a typical map area showing 100+ Google-linked venues, it would fire all getDetails requests simultaneously on load, and then trigger a full map redraw for every single response that came back — so 200 venues meant 200 redraws stacked on each other. There was also a latent bug where changing a single venue would clear all other venue rings off the map (they'd disappear until the next full refresh).
Debounced #processPlaces() — Extracted the method body into #doProcessPlaces(). The outer #processPlaces() now schedules a 150ms debounce, so rapid bursts of calls (e.g., one per arriving API response) coalesce into a single redraw pass instead of stacking.
Rate-limited prefetch — Replaced the fire-all-at-once loop in #prefetchPlaceData() with a queue and concurrency cap (#PREFETCH_CONCURRENCY = 20). Requests drain automatically as each response arrives, keeping at most 20 in flight at a time.
Skips prefetch when layer is hidden — No point fetching data for rings that aren't being displayed. When the layer checkbox is off, proactive fetching is skipped entirely. Sidebar link coloring (red/cyan/magenta) still works reactively via the API interceptor regardless.
Fixed partial-redraw bug — The wme-data-model-objects-changed/added/removed handlers were passing payload.objectIds to limit the redraw scope, but removeAllFeaturesFromLayer always clears everything first — so only the changed venue's rings were redrawn and all others disappeared. Removed the objectIds pass-through so every triggered redraw is always a full scan.
Simplified interceptor callbacks — The setTimeout(() => that.#processPlaces(), 0) wrappers in both the getDetails and fetchFields interceptors were removed. The debounce inside #processPlaces() handles the async scheduling now.
disable() cleans up debounce timer — Cancels any pending debounce on disable so a timer set just before turning GLE off can't fire and redraw after the layer is torn down.
Updated README — Fixed inaccurate method names (GLE.refresh() and GLE.setStrings() don't exist), corrected the strings property names to match the actual code, and documented the new request behavior and layer-visibility gate.
No breaking changes — Public API (enable(), disable(), showTempClosedPOIs, distanceLimit, strings) is unchanged.
Merge upstream: rename @name to SDK Google Link Enhancer
Co-Authored-By: Claude Sonnet 4.6 [email protected]
Merge pull request #12 from JS55CT/master
Performance improvements to SDKGoogleLinkEnhancer — v2026.03.23.00