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

Front page map not loading #1263

Closed
jywarren opened this issue Apr 21, 2020 · 10 comments · Fixed by #1266
Closed

Front page map not loading #1263

jywarren opened this issue Apr 21, 2020 · 10 comments · Fixed by #1266

Comments

@jywarren
Copy link
Member

Seeing this error on front page, which seems new!

Uncaught TypeError: L.layerGroup.mapKnitterLayer is not a function

Seems to be this line, not sure why!

var MapKnitter = L.layerGroup.mapKnitterLayer().addTo(Mapknitterunique);

I also see:

Uncaught TypeError: Cannot read property 'classList' of undefined

Which seems more related to the login system but could be a follow-up bug affecting these lines:

  // Sign up modal form
  signUpForms[0].classList.add("signup-modal-form");
  var signUpModalForm = new SignUpFormValidator(".signup-modal-form");
@jywarren
Copy link
Member Author

My guess is that this is related to Leaflet Environmental Layers changes... that's likely where the L.layerGroup.mapKnitterLayer() item came from. Let's see if we can manually initialize the map using the newer LEL syntax. https://github.com/publiclab/leaflet-environmental-layers/

@jywarren
Copy link
Member Author

Great, this seems to fix it:

L.LayerGroup.EnvironmentalLayers({include: ['mapknitter']}).addTo(Mapknitterunique);

Now i need to figure out why the route it's pointed at isn't working, 404: https://mapknitter.org/map/region/Gulf-Coast.json?minlon=-92.95532226562501&minlat=28.806173508854776&maxlon=-87.3907470703125&maxlat=30.949346915468563

@jywarren
Copy link
Member Author

This should be solved but can be double checked at https://stable.publiclab.org - it's solved if the interactive map loads properly!

@jywarren
Copy link
Member Author

Noting I'm still seeing the front page map not completely load; error is on line 4 of this code segment, although I'm not sure if this is from a library or what because it's not in our codebase here??

$(document).ready(function() {
    var e = document.querySelectorAll("#create-form")
      , t = document.querySelector("#error-message");
    e[0].classList.add("signup-modal-form");
    new SignUpFormValidator(".signup-modal-form");
    if (e[1]) {
        e[1].classList.add("signup-register-form");
        var n = new SignUpFormValidator(".signup-register-form");
        t.innerHTML.includes("error") && (n.updateUI(n.emailElement, !0),
        n.updateUI(n.usernameElement, !0),
        t.innerHTML.includes("Email") && n.updateUI(n.emailElement, !1, "Email already exists"),
        t.innerHTML.includes("Username") && n.updateUI(n.usernameElement, !1, "Username already exists"))
    }
    var o = document.querySelectorAll(".user-sessions-form");
    o[0].classList.add("login-modal-form"),
    LoginFormValidator(".login-modal-form"),
    o[1] && (o[1].classList.add("login-page-form"),
    LoginFormValidator(".login-page-form"))
}),

@jywarren jywarren reopened this Nov 16, 2021
@jywarren
Copy link
Member Author

So strange. The code is from publiclab/plots2#7086 but I don't see how it got pulled into mapknitter's application.js...

@jywarren
Copy link
Member Author

Whoa it's in a direct reference to https://publiclab.org/assets/application-c9ad5ea707b1e200fb756fa08b081cc95ddc22c7c0a674c6c717f55e1fa04513.js

how did we get that in here?

@jywarren
Copy link
Member Author

Very mysterious. Possibly related to intermittent asset loading, waiting to see about that...

@jywarren
Copy link
Member Author

So i think those are from our iframes; they shouldn't be affecting load of the maps:

<iframe style="border:none;" width="90%" height="1000px" src="//publiclab.org/embed/grid/activity:balloon-mapping"></iframe>

@jywarren
Copy link
Member Author

Gonna say i think this may be that a new setting was added to LEL so you have to set it to true before it'll show the map: 9f0d988

@jywarren
Copy link
Member Author

That was it! Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants