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

moveend is fired without a reason due to resize observer #2551

Closed
HarelM opened this issue May 18, 2023 · 0 comments · Fixed by #2552
Closed

moveend is fired without a reason due to resize observer #2551

HarelM opened this issue May 18, 2023 · 0 comments · Fixed by #2552

Comments

@HarelM
Copy link
Collaborator

HarelM commented May 18, 2023

The following browser test fails as of version 3.0.0.pre.5:
It shows that moveend is fired before load on a map that doesn't move.
This is due to the change to ResizeObserver as it fire an event right after subsribing to it.
See #2157 for more info.

    test('No moveend before load', async () => {
        let loadWasFirst = await page.evaluate(() => {
            const map2 = new maplibregl.Map({
                container: 'map', // container id
                style: 'https://demotiles.maplibre.org/style.json', // style URL
                center: [10, 10], // starting position [lng, lat]
                zoom: 10 // starting zoom
            });
            return new Promise<boolean>((resolve, _reject) => {
                map2.once('moveend', () => resolve(false));
                map2.once('load', () => resolve(true));
            });
        });
        expect(loadWasFirst).toBeTruthy();
    }, 20000);
@HarelM HarelM changed the title moveend is fired due to resize moveend is fired without a reason due to resize observer May 18, 2023
nreese added a commit to elastic/kibana that referenced this issue Jul 13, 2023
maplibre change log
https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#310

Breaking changes that required fixes
* 3.0.0 Remove "mapbox-gl-supported" package from API. If needed, please
reference it directly instead of going through MapLibre.
(maplibre/maplibre-gl-js#2451)
* 3.0.0 Resize map when container element is resized. The
"resize"-related events now has different data associated with it
(maplibre/maplibre-gl-js#2157,
maplibre/maplibre-gl-js#2551). Previously the
originalEvent field was the reason of this change, for example it could
be a resize event from the browser. Now it is ResizeObserverEntry, see
more
[here](https://developer.mozilla.org/en-US/docs/web/api/resizeobserverentry).
* 2.2.0 Improve filter specification typings
(maplibre/maplibre-gl-js#1390)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant