UMN-LATIS / elevator-ui

UI for Elevator, a flexible digital asset repository
2 stars 0 forks source link

fix: map marker not rendering if no primaryHandlerId #245

Closed jxjj closed 1 year ago

jxjj commented 1 year ago

This resolves #243, an issue where only a subset of results with locations where showing on the map search results page.

ScreenShot 2023-10-03 at 20 23 39@2x

The issue was the check for primaryHandlerId: when a search result had no primaryHandlerId, the loop skipped rendering the map marker.

A primaryHandlerId is needed for rendering a thumbURL, but not every match will have a thumbnail (assets that are "metadata only" won't have a primaryHandlerId, but they will still have a location).

This PR allows imgSrc to be null, and instead skips any matches without locations.

An additional issue was uncovered once all map markers started loading: Maximum recursive updates exceeded.

This was caused by a conflict between the watchers on markers (vue api) and the event listener for styledata changes (mapbox api). I think the old watchers on markers were before we started clustering map markers on zoom. Map clustering requires rending markers a different way. So, I've removed the old watch on the markers. (I didn't see a noticeable change in performance, but it stopped the vue warnings.)