inocan-group / vue3-google-map

A set of composable components for easy use of Google Maps in your Vue 3 projects.
https://vue3-google-map.com
MIT License
272 stars 54 forks source link

InfoWindow with slot gives insertBefore TypeError errors. #87

Closed ValiDrv closed 2 years ago

ValiDrv commented 2 years ago

There seems to be an issue with removing components that use <slot />

This will work:

<InfoWindow v-if="open" :options="{ position: openedMarker.position }, content: 'Hello World!' }"  @closeclick="open = !open"/>

This will give errors:

<InfoWindow v-if="open" :options="{ position: openedMarker.position"  @closeclick="open = !open">
Hello World!
</InfoWindow>

Errors:

vue.cjs.js:11319 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'insertBefore')
    at insert (vue.cjs.js:11319:16)
    at processCommentNode (vue.cjs.js:8451:13)
    at patch (vue.cjs.js:8403:17)
    at patchBlockChildren (vue.cjs.js:8727:13)
    at processFragment (vue.cjs.js:8789:17)
    at patch (vue.cjs.js:8414:17)
    at patchBlockChildren (vue.cjs.js:8727:13)
    at patchElement (vue.cjs.js:8635:13)
    at processElement (vue.cjs.js:8501:13)
    at patch (vue.cjs.js:8418:21)

Seems to be the case for CustomMarker also (gives the error when computed

This works: <Marker v-for="m of markers" :options="m.options" :key="m.id">...</Marker> This gives errors: <CustomMarker v-for="m of markers" :options="m.options" :key="m.id">...</CustomMarker>

HusamElbashir commented 2 years ago

Hey @ValiDrv

Can you share a minimal reproduction? You can use vite.new/vue

tlhunter commented 2 years ago

@ValiDrv does this look like it might be the same as #85?

ValiDrv commented 2 years ago

Looks like it, but I didn't try that area l array push pop, I had it with a computed property that returned an array, or an object.

I'll make some test cases for you tomorrow. ( Just to make sure it's not related to vite )

ValiDrv commented 2 years ago

Here is a test project:

https://stackblitz.com/edit/vitejs-vite-wfqrqh?file=src/App.vue

What I found, is that if you close the InfoWindow via it's X button AND you have MarkerCluster/CustomMarkers/Marker on the map, you get that error.

If you use vue to show/hide it using v-if, then it doesn't give the error.

The same error happens "randomly" (didn't pinpoint the cause) when we redraw CustomMarkers (zoom in/out or pan the window)

HusamElbashir commented 2 years ago

Tentatively labeling this as a bug until I can take a closer look

tlhunter commented 2 years ago

The same error happens "randomly" (didn't pinpoint the cause) when we redraw CustomMarkers (zoom in/out or pan the window)

This sounds a lot like what I'm seeing in #85. I suspect these two issues may have the same root cause.

HusamElbashir commented 2 years ago

This should be fixed in v0.13.1. Let me know if the issue persists or if you encounter other issues.

ValiDrv commented 2 years ago

In preliminary tests it looks like it's working, thank you.