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

Setting map.showTileBoundaries = true causes TypeError: t is undefined. #3849

Closed
mg262 opened this issue Dec 21, 2016 · 6 comments
Closed

Setting map.showTileBoundaries = true causes TypeError: t is undefined. #3849

mg262 opened this issue Dec 21, 2016 · 6 comments
Assignees
Labels

Comments

@mg262
Copy link

mg262 commented Dec 21, 2016

MapBox GL JS v0.28.0 with Firefox 50.0.2:

I'm drawing a simple map as follows:

var map = new mapboxgl.Map({
    container: 'map',
    style: 'http://localhost:8080/styles/simple.json',
    zoom: 14,
    center: [0.12, 52.2]
});

This works fine, but if I add

map.showTileBoundaries = true;

afterwards, I get an error:

TypeError: t is undefined.

on mapbox-gl.js:72:4430 .

@jfirebaugh
Copy link
Contributor

I'm not able to reproduce this in a simple example. Can you create a self-contained JSFiddle that demonstrates the issue?

@mg262
Copy link
Author

mg262 commented Dec 21, 2016

Unfortunately I can't reproduce the crash on JSFiddle. Could you try opening up this html in firefox?

<!DOCTYPE html>
<html>
<head>
    <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.js'></script>
    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.css' rel='stylesheet' />
    <style>
        body { margin:0; padding:0; }
        #map { position:absolute; top:0; bottom:0; width:100%; }
    </style>
</head>
<body>

<div id='map'></div>
<script>

mapboxgl.accessToken = 'pk.eyJ1IjoiZWRlbnJheWdhcmRuZXIiLCJhIjoiRlZRVlhqOCJ9.tDrWaeNRbMCtXAovQLYuzA';
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v8',
    center: [0.12, 52.2],
    zoom: 14
});

map.showTileBoundaries = true;
</script>

</body>
</html>

@jfirebaugh
Copy link
Contributor

jfirebaugh commented Dec 21, 2016

Yes, thank you! It seems to be a regression from c4d7766.

cc @mourner

@mg262
Copy link
Author

mg262 commented Dec 21, 2016

Odd that it didn't trigger in JSFiddle. (https://jsfiddle.net/z4c74y1v/).

Also, thanks for the very quick responses!

@mourner mourner self-assigned this Dec 21, 2016
@mourner
Copy link
Member

mourner commented Dec 21, 2016

Sorry about the regression, will look into it.

@mg262
Copy link
Author

mg262 commented Dec 22, 2016

@mourner I think it was caused on this line:

const sourceCache = this.style.sourceCaches[Object.keys(this.style.sourceCaches)[0]];

Can this.style.sourceCaches be empty?

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

No branches or pull requests

3 participants