onItemReady in Repeater bug?

This test page: https://www.chamonix360.com/test

I got a collection of Trails where all the trail specifications are stored. I got a new collection called TrailArticles where I bundle trails together for a specific article on the site. TrailArticles uses a 1-1 reference to Trails to identify the trail and then TrailArticles contains additional data like the order in which trails should be listed for the page, the highlight pictures, the summary text, etc.

Now on the page I got a dataset connected to a repeater to pull out the data like the Title, summary, and the 2 images directly from TrailArticles for each item in the repeater. I am then using this code to pull the trail specifications data out from the referenced Trails collection and then execute a formatting function against that data:

import wixWindow from ‘wix-window’ ;
import { trailMonthName , trailMonthPeriod , trailKidsAge , trailDogsAllowed } from ‘public/trail-display.js’ ;

$w . onReady ( function () {

 // Pull Date into the Repeater 
 $w ( "#repeaterArticles" ). onItemReady (( $item ,   itemData ,   index )   =>   { 
     
     console . log ( "index:"   +   index   ) 
     console . log ( "item:"   +   itemData . trail . title   ) 
     console . log ( "item:"   +   itemData . trail . length   ) 
     console . log ( "item:"   +   itemData . trail . goStart   ) 
     console . log ( "item:"   +   itemData . trail . goEnd   ) 

     $w ( "#textSpecLength" ). text   =   String ( itemData . trail . length )   +   "km" ; 
     $w ( "#textElevation" ). text   =   itemData . trail . elevUp   +   "m / "   +   itemData . trail . elevDown   + "m" ; 

     // When to Go 
     let   dateGoStart   =   **new**   Date ( itemData . trail . goStart ); 
     let   dateGoEnd   =   **new**   Date ( itemData . trail . goEnd ); 
     let   dateGoStartText   =   trailMonthPeriod ( dateGoStart . getUTCDate ())   +   " "   +   trailMonthName ( dateGoStart . getUTCMonth ()); 
     let   dateGoEndText   =   trailMonthPeriod ( dateGoEnd . getUTCDate ())   +   " "   +   trailMonthName ( dateGoEnd . getUTCMonth ());    
     $w ( "#textWhenGo" ). text   =   dateGoStartText   +   " - "   +   dateGoEndText ; 
     
 });   // End Loop Through Repeater Items 

});

// Map Preview Lighthouse
export function butTrailMap_click ( event ) {
let scope = $ w . at ( event . context );
let trailID = scope ( ‘#datasetArticles’ ). getCurrentItem ();
wixWindow . openLightbox ( ‘ShowBigTrailMap’ , trailID . trail );
}

The weird thing or ‘bug’ is that the text fields for the repeater items are just showing the data of the first item in the dataset. They dont change per item like they do for all the other pages on the site. The only difference I can see is that on the other pages the data is pulled directly from a single collection and in this case the data is pulled from a referenced collection. The console is showing the right values though so I wouldnt understand why the text field on the page simply wont show the correct data. Is this a bug or am I missing something?

No input from anyone? I have submitted a bug report but am not hearing anything back

You need to use the repeated item selector $item instead of $w:

 $item("#textSpecLength").text = String(itemData.trail.length) + "km";
 $item("#textElevation").text = itemData.trail.elevUp + "m / " + itemData.trail.elevDown +"m";

Thanks so much. I dont understand why I did not have to do that with the other repeaters where I am performing the exact same thing. But at least it works now!