senangwebs-tour 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4269,11 +4269,27 @@
4269
4269
 
4270
4270
  /**
4271
4271
  * Populate icon grid from SenangStart icons (baked in at build time)
4272
+ * Waits for ss-icon custom element to be defined to avoid race conditions
4272
4273
  */
4273
- populateIconGrid() {
4274
+ async populateIconGrid() {
4274
4275
  const grid = document.getElementById("hotspotIconGrid");
4275
4276
  if (!grid) return;
4276
4277
 
4278
+ // Wait for ss-icon custom element to be defined before populating
4279
+ // This prevents race conditions where icons don't render if the
4280
+ // custom element isn't registered yet when this method runs
4281
+ try {
4282
+ if (customElements.get('ss-icon') === undefined) {
4283
+ // Give a reasonable timeout to avoid infinite waiting
4284
+ await Promise.race([
4285
+ customElements.whenDefined('ss-icon'),
4286
+ new Promise((_, reject) => setTimeout(() => reject(new Error('ss-icon timeout')), 5000))
4287
+ ]);
4288
+ }
4289
+ } catch (err) {
4290
+ console.warn('ss-icon custom element not available, icon grid may not render properly:', err.message);
4291
+ }
4292
+
4277
4293
  // Clear existing content
4278
4294
  grid.innerHTML = "";
4279
4295
 
@@ -4844,8 +4860,8 @@
4844
4860
  // Setup event listeners
4845
4861
  this.setupEventListeners();
4846
4862
 
4847
- // Populate icon grid
4848
- this.uiController.populateIconGrid();
4863
+ // Populate icon grid (async to wait for custom element registration)
4864
+ await this.uiController.populateIconGrid();
4849
4865
 
4850
4866
  // Load saved project if exists (but only if it has valid data)
4851
4867
  if (this.storageManager.hasProject()) {
@@ -5359,6 +5375,7 @@
5359
5375
  render() {
5360
5376
  this.uiController.renderSceneList();
5361
5377
  this.uiController.renderHotspotList();
5378
+ this.uiController.populateIconGrid(); // Re-render icon grid to ensure icons display
5362
5379
 
5363
5380
  const currentScene = this.sceneManager.getCurrentScene();
5364
5381
  const currentHotspot = this.hotspotEditor.getCurrentHotspot();