communityconnect icon indicating copy to clipboard operation
communityconnect copied to clipboard

Clicking on markers will not scroll to the correct card.

Open microcat49 opened this issue 8 years ago • 1 comments

For some of the markers, clicking on markers will not scroll to the correct card. I was able to recreate this issue with:

Chelsea-Revere-Wintrhop Elder Services Saint Lukes Food Pantry Beth Israel Deaconess HealthCare - Chelsea Just-A-Start Affordable Housing in Boston

microcat49 avatar Nov 28 '18 01:11 microcat49

The issue that we're having here is with the indexes not matching up. When we developed a hash table of different coordinates and the indexes of those coordinates. Which I've included a snippet below.

var locationAddressHashTable = {};

      Object.entries(filtered_json).forEach(([index,  org]) =>{

      if(org.coordinates){

        if(locationAddressHashTable.hasOwnProperty(createMarkerId(org.coordinates))){

            locationAddressHashTable[createMarkerId(org.coordinates)]['orgs'].push(index)

      } else {
          locationAddressHashTable[createMarkerId(org.coordinates)] = {'orgs': [index] , isOpen: false }
      }
      }

We did not anticipate the list order to change. In the file ResultList.js we run the following code in the render function.

    // Render will be called every time this.props.data is updated, and every time handleSortChange
    // updates the this.state.dataSort variable.
    // this.state.dataSort() sorts data to feed into the OrganizationCards without modifying the
    // source of data
    const sortedData = this.state.dataSort();

This will change the order of the list to so the indices will not match up with the initial index they were assigned.

microcat49 avatar Dec 19 '18 01:12 microcat49