Skip to content

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

Description

@Athina09

Page / Route

Other

Selected Location

Water Project / Waterbody dashboard (where getWaterbodyData is called)

Bug Description

In src/actions/getWaterbodyData.jsx, the function calls waitForFeatures(...) to wait for vector features (waterbody, MWS, ZOI). However, waitForFeatures is defined later in the function body using a const declaration. This can trigger a runtime error (ReferenceError / TDZ) and break the data-loading flow.

Steps to Reproduce

  1. Open the Water Project / Waterbody dashboard.
  2. Select State, District, and Tehsil.
  3. Choose/apply the relevant waterbody selection so getWaterbodyData runs.
  4. Observe that the dashboard fails to load or errors in the console (especially when vector features aren’t immediately available).

Expected Behavior

getWaterbodyData should reliably wait for vector source features and return wb/mws/zoi data without throwing runtime errors.

Filters Applied

Any active filter/pattern selections used to load the waterbody view.

Screenshots / Logs

No response

Browser

None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions