tinuzz / wp-plugin-trackserver

A WordPress plugin for GPS tracking and publishing
https://wordpress.org/plugins/trackserver/
36 stars 12 forks source link

JavaScript errors when live track ID changes on the current page #7

Closed tinuzz closed 7 years ago

tinuzz commented 7 years ago

Uncaught (in promise) TypeError: Cannot read property 'track' of undefined at Object.do_draw (trackserver.js?ver=3.0-20170227:139) at alltracksPromise.then.str (trackserver.js?ver=3.0-20170227:387) do_draw @ trackserver.js?ver=3.0-20170227:139 alltracksPromise.then.str @ trackserver.js?ver=3.0-20170227:387

'mymapdata' has the track IDs even for live maps, and it is set only at page load. When the query for a live track (user=xyz) returns a track that is not in the 'mymapdata' object, which happens when the user started a new tracks while the page is open in the browser, these JavaScript error occur.

tinuzz commented 7 years ago

Given the current architecture, it is not feasable to make the map switch to the new map ID. A workaround is implemented that shows a popup on the map, suggesting a page reload. A page reload will put things back in sync.