ternandsparrow / wild-orchid-watch-pwa

Progressive Web App for the Wild Orchid Watch citizen science project
https://app.wildorchidwatch.org
4 stars 4 forks source link

Drag map pin not moving pin #98

Closed tomsaleeba closed 2 years ago

tomsaleeba commented 2 years ago

Env Firefox 100, Chromium 101 both on Linux

Steps

Expected The pin updates to the center of the map and no errors are shown in the console

Actual The pin on the map does not update and many errors (all the same) appear in the console. The error messages (in Firefox) are

TypeError: e.zb is undefined
    updateMarker googleMap.vue:108
    VueJS 4
    n6 helpers.js:15
    gw js:258
    trigger js:253
    nf js:84
    nf js:84
    notify js:260
    d map.js:41
    lp js:300
    a helpers.js:73
    setTimeout handler*f/< trycatch.js:94
    Sh js:144
    start js:300
    Uh js:145
    m map.js:41
    Pa map.js:42
    h map.js:68
    Et map.js:62
    a helpers.js:73
    l trycatch.js:103
    Po common.js:70
    Et map.js:61
    b map.js:69
    Ht map.js:64
    Lh map.js:99
    Xd common.js:155
    Xd common.js:151
    o common.js:61
    a helpers.js:73
    d trycatch.js:183
    j instrument.js:458
    wl common.js:11
    Hha common.js:61
    J common.js:59
    a helpers.js:73
    d trycatch.js:183
    j instrument.js:458
    wl common.js:11
    Ao common.js:59
    Bo common.js:62
    Yka map.js:57
    j map.js:118
    Si js:179
    promise callback*Si js:179

That first line of the trace points to image

Here's a screencast of the bug

https://user-images.githubusercontent.com/1773838/168950531-02855e66-0579-4cbf-99f2-fc3663653a2a.mp4

I swear this worked great when it was first added and I haven't bumped dependency versions (pretty sure I haven't) so I don't know what's gone wrong. Maybe the underlying JS that drives Google Maps has changed because it's pulled live and not part of our dependencies :thinking: .

tomsaleeba commented 2 years ago

I just realised the code that throws the error is in our code base (not a dependency).

Looking at those properties, they look like minified property names. Possible theory: this worked on the initial commit because the minified property names matched, but those names can change on every rebuild, so they no longer work. The trick will be to avoid having to use these minified names. Maybe we can swap to using a non-minified version of the maps code (not exactly sure where that is) so the field names are predictable.

tomsaleeba commented 2 years ago

@j-robinson could you please try to reproduce this bug and fix it if you have time.

CC @tokmakoff

tomsaleeba commented 2 years ago

image

Setting a break point on that code, it seems like the property names in my build are Ab and Va.

sbbu commented 2 years ago

Thanks for figuring out what the issue was @tomsaleeba. Luckily there are methods for accessing those properties so it was an easy fix https://github.com/ternandsparrow/wild-orchid-watch-pwa/commit/c04ab8bf878c87e8bb33f817d035ffbe09892abe

tomsaleeba commented 2 years ago

Works great, thanks :muscle: