Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New post location form: bug on the search-for-location #6915

Open
nstjean opened this issue Dec 4, 2019 · 18 comments
Open

New post location form: bug on the search-for-location #6915

nstjean opened this issue Dec 4, 2019 · 18 comments
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed

Comments

@nstjean
Copy link
Contributor

nstjean commented Dec 4, 2019

I am unable to type anything in to the input "By place name" and search.

FireShot Capture 093 - 🎈 Public Lab_ Post - localhost

This value is being passed to panMapToGeocodedLocation in leaflet-blurred-location... however the same input doesn't throw an error in locations/_form.html.erb - it doesn't search properly, that will have to be fixed as well, but it doesn't show "Oops, something went wrong!".

I will look into what is causing this!

@nstjean nstjean added the bug the issue is regarding one of our programs which faces problems when a certain task is executed label Dec 4, 2019
@jywarren
Copy link
Member

jywarren commented Dec 4, 2019 via email

@nstjean
Copy link
Contributor Author

nstjean commented Dec 4, 2019

Can someone help me find the correct Javascript for this? In the views/locations/_form.html.erb file there is very clear Javascript that creates the blurredLocation object and calls panMapToGeocodedLocation. But I can't find that code anywhere for views/editor/rich.html.erb - is it in leaflet-blurred-location ? PL.Editor ?

@nstjean
Copy link
Contributor Author

nstjean commented Dec 4, 2019

So the error message appears to be from global maps and google's autocomplete API - probably failing on localhost because the site is not registered to their system. The error does not show up on the live site https://publiclab.org/post - this is what I get instead:

FireShot Capture 094 - 🎈 Public Lab_ Post - publiclab org

Which is the exact same behavior that happens on the popup modal:

FireShot Capture 095 - 🎈 Public Lab_ Extensible OSS - publiclab org

I'm guessing that this bug is somewhere in leaflet-blurred-location, I'll have to set that repo up and get it working.

@nstjean
Copy link
Contributor Author

nstjean commented Dec 4, 2019

But at the same time I still don't understand why I'm getting the error message on local on the post form, but not on the popup modal.

@jywarren
Copy link
Member

jywarren commented Dec 4, 2019 via email

@nstjean
Copy link
Contributor Author

nstjean commented Dec 4, 2019

Ok I'll look at that code and try to figure out the difference!

@jywarren
Copy link
Member

jywarren commented Dec 5, 2019

Hi @nstjean it sounds like you've found a couple possible overlapping bugs. If it's helpful to separate them into 2 issues that could help in the documentation! Thanks!

@jywarren
Copy link
Member

jywarren commented Dec 5, 2019

Hi @sagarpreet-chadha this is something we'd like to have a system test for!

@nstjean
Copy link
Contributor Author

nstjean commented Dec 6, 2019

Ok, I'll open an issue in LEL about the search getting stuck and not completing, and keep this one open for the "Oops something went wrong" issue with the form.

@nstjean
Copy link
Contributor Author

nstjean commented Dec 6, 2019

Oops, I meant leaflet-blurred-location!

@nstjean
Copy link
Contributor Author

nstjean commented Dec 6, 2019

Here we go, issue for the location search: publiclab/leaflet-blurred-location#214

@nstjean
Copy link
Contributor Author

nstjean commented Dec 6, 2019

I searched all over the code to try to figure out the difference between these two forms and why they are behaving differently.

First I realized that the "Oops!" error statement is what should be showing, since there is an error with the google autocomplete.

Finally I realized that it's the timing of the popup that is the issue. When I included locations/form in a stand-alone non-popup page the error shows up just as it should!

FireShot Capture 097 - 🎈 Public Lab_ Stats - localhost

I believe the reason it's not showing up on the pop-up modal is simply because it pops up later, and the error is already being triggered on the page on reload.

Should I continue spending time figuring out how to get the timing corrected so the error shows up on the modal pop-up? Either way the issue will disappear when publiclab/leaflet-blurred-location#214 is solved.

@sagarpreet-chadha
Copy link
Contributor

Hey @nstjean ,
I think we should focus on the features first and we resolve all the bugs at the end. What do you think?
PS: If you think you are very close to finding the bug cause, you may continue else let's solve this at the end. Thanks!!!

@nstjean
Copy link
Contributor Author

nstjean commented Dec 6, 2019

I think that's a good idea. Thanks!

@jywarren
Copy link
Member

I just wanted to say i went to https://publiclab.org/post and tried using the input, i was able to use By place name and choose a location, but the map did not move and I got a loading spinner with the JS error:

Uncaught TypeError: Cannot read property 'geometry' of undefined
    at geocodeStringAndPan (Leaflet.BlurredLocation.js:1014)
    at Leaflet.BlurredLocation.js:956

I think maybe we're parsing the response of the locations api incorrectly? This may be a 3rd bug that has to be broken out, but it seems to match one of your above observations (from the live site, not the Ooops bug!

@nstjean
Copy link
Contributor Author

nstjean commented Dec 10, 2019

Quite possible!

@jywarren
Copy link
Member

OK! I've captured (lol) a sample response that I think we have to reconfigure around. I wonder when this changed and when it stopped working?

https://gist.github.com/jywarren/eec9fcec10528caaf463df6068846b0e

Can you try eliminating this variant of the bug by changing the parsing to match this? Then we can tackle Oops, something went wrong! after that!

Thanks, @nstjean !

@jywarren
Copy link
Member

Ah - let's move this most recent one -- the geometry one - over to publiclab/leaflet-blurred-location#214 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed
Projects
None yet
Development

No branches or pull requests

3 participants