maplibre / ngx-maplibre-gl

Angular binding of maplibre-gl
https://maplibre.org/ngx-maplibre-gl/
MIT License
65 stars 25 forks source link

Sending lngLat changes to a marker before mapCreated has been fired causes crash #144

Closed MuresanSergiu closed 3 months ago

MuresanSergiu commented 4 months ago

This seems to happen in the MarkerComponent class because the ngOnChanges handler doesn't check if markerInstance has been assigned accessing 'setLngLat' of undefined. The crash is inconsistent to replicate

    ngOnChanges(changes) {
        if (changes.lngLat && !changes.lngLat.isFirstChange()) {
            this.markerInstance.setLngLat(this.lngLat);
        }
    ...
    }

Using latest release: 17.4.1 in Angular 17

HarelM commented 4 months ago

Feel free to submit a PR to fix this, seems like you know where to fix this, right?

HarelM commented 3 months ago

Is this issue still relevant? Can I close this?

MuresanSergiu commented 3 months ago

Did it get fixed? I haven't had the time to push a fix for this and currently I'm using a workaround...

HarelM commented 3 months ago

If it's not important enough for you to fix it then I'll be closing this issue. Feel free to submit a PR any time you want 😃

MuresanSergiu commented 3 months ago

But the issue still exists... That's kinda disingenuous, don't you think?

HarelM commented 3 months ago

It's very hard to understand the issue from the description. I haven't encountered it. While I don't argue that there is an issue, apparently it's not important enough for anyone to fix it, so there's no reason to keep this issue open. If anyone in the future will encounter it and would like to fix it I can always link to this issue.

MuresanSergiu commented 3 months ago

If you "don't argue that there is an issue" then don't close it. Do issues only exist for those that have the problem AND are willing to fix it? No, of course not.

I didn't know it was difficult to understand the issue, but I would expect people to at least ask before closing it. I would gladly give a more in-depth explanation.

I'm deeply disappointed in this type of behavior.