Page MenuHomePhabricator

TypeError: undefined is not an object (evaluating 'el. _leaflet_pos') at _getMapPanePos
Open, HighPublic2 Estimated Story PointsBUG REPORT

Description

New error appearing since 9th December

Errors in the form "TypeError: Cannot read properties of undefined (reading '_leaflet_pos') ", TypeError: Cannot read property '_leaflet_pos' of undefined , TypeError: undefined is not an object (evaluating 'el. _leaflet_pos')

236 in last 24hrs
https://logstash.wikimedia.org/goto/b51e1f7372df07d9caa13f20856a855c

at getPosition  URL1:80:1
at NewClass._getMapPanePos  URL1:109:749
at NewClass._getNewPixelOrigin  URL1:110:216
at NewClass._move  URL1:105:956

URL1: https://ru.m.wikipedia.org/w/load.php?lang=ru&modules=ext.kartographer.dialog%7Cmapbox%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-interactions%2Cindicators&skin=minerva&version=1vr0u

Event Timeline

I ran into something simliar to this in development.

getPosition — mapbox-lib.js:5023
_getMapPanePos — mapbox-lib.js:7034
_moved — mapbox-lib.js:7038
getCenter — mapbox-lib.js:6399
(anonymous function) — load.php:71   
mightThrow — jquery.js:3766
(anonymous function) — jquery.js:3834

This trigger from the getCenter() when closing the fullscreen dialog (where we reset the position of the dynamic parent map). Probably the fullscreen map didn't finish loading in this particular case.

instance.closing.then(function() {
    if (map.parentMap) {
        // FIXME we need to correct for the footerbar offset
        map.parentMap.setView(
        map.getCenter(),
        map.getZoom()
        );
    }
});

The render function of the index.js of dialog module.

Jdlrobson triaged this task as High priority.EditedApr 14 2022, 7:50 PM

This error appears as either "TypeError: Cannot read properties of undefined (reading '_leaflet_pos') " or "TypeError: undefined is not an object (evaluating 'el. _leaflet_pos') ". Combined error rate is 2111 errors per week, making this one of our top 3 errors by volume.

I just had another instance of this, and this time, it was because I tried to click the X to exit fullscreen, but at the same time I accidentally zoomed (because I hit the scroll wheel) and the map was still in the transition of the zoom as it got closed.

[Error] TypeError: undefined is not an object (evaluating 'el.
_leaflet_pos')
	getPosition (load.php:87:992)
	_getMapPanePos (load.php:117:761)
	_getNewPixelOrigin (load.php:118:231)
	_move (load.php:113:975)
	_onZoomTransitionEnd (load.php:122:700)
	_onZoomTransitionEnd

I suspect this is the same issue as in T316431: JavaScript error every time when closing a fullscreen map (same error about "reading _leaflet_pos"), but maybe in a differnet place in the code that was not touched as part of T316431.

WMDE-Fisch subscribed.

The issue is clearly coming from the autoreload part in the nearby feature. So when you move the map or zoom and quickly close it the events that listen to zoom and move try to execute an updated while the map is already destroyed.

Since we're planing to remove the autoreload feature anyways with the next changes. These issues should be gone with https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Kartographer/+/881896 is merged.

Still occurring and I think I managed to replicate the issue.

safaribug.gif (700×1 px, 1 MB)

This may relate to T297519.

Change 902673 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Disable BoxZoom event as well when fullscreen map closes

https://gerrit.wikimedia.org/r/902673

thiemowmde set the point value for this task to 2.

Uh, I have never seen this box. Turns out it's a Leaflet feature, called "BoxZoom". Hold Shift, draw this box, and the map will zoom into the selected area. When I press Esc while I still hold down the Shift key I can reproduce the issue in all browsers. I made another patch.

Change 902673 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Disable BoxZoom event as well when fullscreen map closes

https://gerrit.wikimedia.org/r/902673

My understanding is this went out with wmf2, but I'm not seeing any change in the error rate, so my replication wasn't the exact same as the issue we're seeing here :-(