Fix inserted widget runtime to honor external script load order (Leaflet/map rendering)#31
Draft
Fix inserted widget runtime to honor external script load order (Leaflet/map rendering)#31
Conversation
Open
Agent-Logs-Url: https://github.com/wigify/wigify/sessions/3dc5cf5e-0cc1-42e0-9522-c0256e6aa9e7 Co-authored-by: saeedvaziry <61919774+saeedvaziry@users.noreply.github.com>
Agent-Logs-Url: https://github.com/wigify/wigify/sessions/3dc5cf5e-0cc1-42e0-9522-c0256e6aa9e7 Co-authored-by: saeedvaziry <61919774+saeedvaziry@users.noreply.github.com>
Agent-Logs-Url: https://github.com/wigify/wigify/sessions/3dc5cf5e-0cc1-42e0-9522-c0256e6aa9e7 Co-authored-by: saeedvaziry <61919774+saeedvaziry@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix map insertion issue in widget
Fix inserted widget runtime to honor external script load order (Leaflet/map rendering)
Apr 2, 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.
Inserted map widgets could render in Preview but fail after insertion because widget JS executed before external library scripts (e.g., Leaflet) were ready. This change aligns inserted-widget runtime behavior with expected browser script ordering so library-dependent widgets initialize reliably.
Runtime script execution ordering
widget.htmlwidget bootstrap to execute injected<script>tags sequentially.src), execution now advances ononload/onerror, then runssource.jsonly after the injected script queue completes.Regression coverage
tests/unit/widget-runtime.test.tsto assert thatsource.jsobserves external library side effects before it runs.Example of the ordering behavior now enforced:
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:
example.com/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node -e const sendRequest = require('https').request; const options = { "method": "GET", "headers": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Connection": "close", "Origin" saryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartition(dns block)If you need me to access, download, or install something from one of these locations, you can either: