Skip to content

[Bug] Fix getWaterbodyData runtime error: waitForFeatures used before initialization#350

Open
Athina09 wants to merge 1 commit intocore-stack-org:developmentfrom
Athina09:bugfix/getwaterbodydata-waitforfeatures
Open

[Bug] Fix getWaterbodyData runtime error: waitForFeatures used before initialization#350
Athina09 wants to merge 1 commit intocore-stack-org:developmentfrom
Athina09:bugfix/getwaterbodydata-waitforfeatures

Conversation

@Athina09
Copy link
Copy Markdown

Summary

Fixes a potential runtime error in src/actions/getWaterbodyData.jsx where waitForFeatures (declared with const) could be referenced before initialization.

What was wrong

Inside getWaterbodyData, the code calls waitForFeatures(...) to await vector features (waterbody/MWS/ZOI). In the previous ordering, waitForFeatures was defined later in the function body, which can throw a ReferenceError (TDZ) and break the water dashboard loading flow.

What changed

  • Moved the waitForFeatures helper so it is declared before the first time it is used.
  • Kept the existing logic to resolve once features are available.

Files changed

  • src/actions/getWaterbodyData.jsx

@Athina09 Athina09 changed the title fix: waitForFeatures defined before use [Bug] Fix getWaterbodyData runtime error: waitForFeatures used before initialization Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant