This repository was archived by the owner on Jun 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -125,22 +125,28 @@ function parseCityLabelItem(item) {
125125}
126126
127127function loadCityLabels ( ) {
128- loadData (
129- new URL ( "../../asset/labels.tsv" , import . meta. url ) ,
130- parseCityLabelItem ,
131- cityLabels , // Store city labels in the cityLabels array
132- ( ) => { } ,
133- ) ;
128+ return new Promise ( ( resolve ) => {
129+ loadData (
130+ new URL ( "../../asset/labels.tsv" , import . meta. url ) ,
131+ parseCityLabelItem , // sets cityLabelsByClusterId
132+ cityLabels , // Store city labels in the cityLabels array
133+ ( ) => {
134+ resolve ( ) ;
135+ } ,
136+ ) ;
137+ } ) ;
134138}
135139
136- export function loadDataPoints ( ) {
140+ export async function loadDataPoints ( ) {
141+ await loadCityLabels ( ) ;
142+ // `parseDataPointItem` relies on `cityLabelsByClusterId`, which is populated by `loadCityLabels`.
143+ // So, we need to ensure that city labels are fully loaded before loading data points.
137144 loadData (
138145 new URL ( "../../asset/data.tsv" , import . meta. url ) ,
139146 parseDataPointItem ,
140147 data , // Separate array for data points
141148 handleDataPointsLoaded ,
142149 ) ;
143- loadCityLabels ( ) ; // Load city labels after loading data points
144150}
145151
146152export function loadConcepts ( ) {
You can’t perform that action at this time.
0 commit comments