NYCPlanning / labs-regional-viz

An interactive mapping experience that highlights regional planning data and trends.
Other
6 stars 1 forks source link

Navigating to /about destroys the map, sources break #178

Closed chriswhong closed 5 years ago

chriswhong commented 6 years ago

To Reproduce:

Load the app, navigate to /about, click Metro Mapper. When the home route loads again, the map will not contain any overlay polygons.

andycochran commented 6 years ago

This is the case for going to any route, then /about, then back to the original route.

allthesignals commented 6 years ago

Here are the errors I'm seeing:

Errors
0:9457 Uncaught Error: Syntax error, unrecognized expression: #7.02/40.857/-73.528
    at Function.oe.error (0:9457)
    at oe.tokenize (0:10109)
    at oe.select (0:10536)
    at Function.oe [as find] (0:8761)
    at _.fn.init.find (0:10789)
    at new _.fn.init (0:10899)
    at Object._ [as $] (0:8055)
    at o.getJQueryElement (0:108636)
    at o.getVerticalCoord (0:108649)
    at 0:108660
oe.error @ 0:9457
oe.tokenize @ 0:10109
oe.select @ 0:10536
oe @ 0:8761
find @ 0:10789
_.fn.init @ 0:10899
_ @ 0:8055
getJQueryElement @ 0:108636
getVerticalCoord @ 0:108649
(anonymous) @ 0:108660
(anonymous) @ 0:66102
e @ 0:66555
scrollVertical @ 0:108658
(anonymous) @ page.js:28
g @ 0:28423
e.invoke @ 0:27980
e.flush @ 0:27848
e.flush @ 0:28050
e.end @ 0:28160
e._runExpiredTimers @ 0:28621
_boundRunExpiredTimers @ 0:28118
setTimeout (async)
i.setTimeout @ 0:28104
e._installTimerTimeout @ 0:28667
e._setTimeout @ 0:28565
e.later @ 0:28426
st.next @ 0:44558
didTransition @ page.js:27
_ @ 0:51551
h @ 0:63630
(anonymous) @ 0:65469
(anonymous) @ 0:64834
A @ 0:65894
P @ 0:66076
T @ 0:66061
e.invoke @ 0:27978
e.flush @ 0:27848
e.flush @ 0:28050
e.end @ 0:28160
e.run @ 0:28249
e.join @ 0:28256
st.join @ 0:44128
(anonymous) @ 0:62205
e.flaggedInstrument @ 0:43745
handleEvent @ 0:62204
e.default.r.Mixin.create.l.handleEvent @ 0:61413
_bubbleEvent @ 0:61714
(anonymous) @ 0:61642
dispatch @ 0:13099
g.handle @ 0:12907
0:85827 Error: layers.empty-polygons-county: source "empty-polygons" not found
    at Function.t.exports.emitErrors (0:85729)
    at t._validate (0:85687)
    at t.addLayer (0:85687)
    at t.addLayer (0:85801)
    at o.init (0:107254)
    at o.r [as init] (0:60053)
    at new o (0:58427)
    at Function.s.create (0:58601)
    at e.create (0:29022)
    at n.create (0:33152)
a.fire @ 0:85827
t.exports.emitErrors @ 0:85729
t._validate @ 0:85687
t.addLayer @ 0:85687
t.addLayer @ 0:85801
init @ 0:107254
r @ 0:60053
o @ 0:58427
s.create @ 0:58601
e.create @ 0:29022
n.create @ 0:33152
(anonymous) @ 0:21027
e.evaluate @ 0:19322
e.next @ 0:26770
e.execute @ 0:26756
n.handleException @ 0:26146
e.handleException @ 0:26345
e.throw @ 0:26025
t.evaluate @ 0:20232
e.execute @ 0:26012
e.rerender @ 0:26376
s.render @ 0:37617
e.runInTransaction @ 0:40983
e._renderRoots @ 0:37895
e._renderRootsTransaction @ 0:37933
e._revalidate @ 0:37978
e.invoke @ 0:27980
e.flush @ 0:27848
e.flush @ 0:28050
e.end @ 0:28160
e.run @ 0:28249
e.join @ 0:28256
st.join @ 0:44128
(anonymous) @ 0:44206
a.fire @ 0:85827
t._render @ 0:85801
(anonymous) @ 0:85801
requestAnimationFrame (async)
frame @ 0:85811
t._rerender @ 0:85801
t._render @ 0:85801
(anonymous) @ 0:85801
requestAnimationFrame (async)
frame @ 0:85811
t._rerender @ 0:85801
t._render @ 0:85801
(anonymous) @ 0:85801
requestAnimationFrame (async)
frame @ 0:85811
t._rerender @ 0:85801
t._render @ 0:85801
(anonymous) @ 0:85801
requestAnimationFrame (async)
frame @ 0:85811
t._rerender @ 0:85801
t._render @ 0:85801
(anonymous) @ 0:85801
requestAnimationFrame (async)
frame @ 0:85811
t._rerender @ 0:85801
t._render @ 0:85801
(anonymous) @ 0:85801
requestAnimationFrame (async)
frame @ 0:85811
t._rerender @ 0:85801
t._render @ 0:85801
(anonymous) @ 0:85801
requestAnimationFrame (async)
frame @ 0:85811
t._rerender @ 0:85801
t._update @ 0:85801
t._onData @ 0:85801
a.fire @ 0:85827
a.fire @ 0:85827
a.fire @ 0:85827
a.fire @ 0:85827
t._tileLoaded @ 0:85529
r @ 0:85537
s.receive @ 0:85807

allthesignals commented 6 years ago

This comes down to the presence of the MapboxGL location hash and page section anchors (/about#my-section). Because the former uses /s, it's confusing one of jQuery's internal selector libs.

We'll need a way to differentiate between the special location hash and page section anchors.

allthesignals commented 6 years ago

Closed by 66172300

chriswhong commented 6 years ago

Just observed this on the deployed site, re-opening.

allthesignals commented 6 years ago

@chriswhong observed the same errors or what?

chriswhong commented 6 years ago

Didn't inspect, just saw that the map was blank (basemap only) when coming back to the map from /About

allthesignals commented 6 years ago

Alright - for some reason, the sources don't get re-computed when you navigate back to the map route. Not sure why yet

screen shot 2018-05-22 at 4 20 37 pm screen shot 2018-05-22 at 4 20 31 pm
allthesignals commented 6 years ago

The reason this happens is that they become "cartovectors" - we have some kind of memory leakage somewhere so the resolved & munged mapbox "vector" types are saved and filtered out here: .filter(key => sources[key].type === 'cartovector').

allthesignals commented 6 years ago

The reason this happens is that they become "cartovectors" - we have some kind of memory leakage somewhere so the resolved & munged mapbox "vector" types are saved and filtered out here: .filter(key => sources[key].type === 'cartovector').

allthesignals commented 6 years ago

Closed by f6e92ae7f3446fcd782e6d171de7abe4051d7908

hannahkates commented 5 years ago

Looks like this was successfully implemented but the issue was never closed. Closing now.