MelihAltintas / vue3-openlayers

Web map Vue 3.x components with the power of OpenLayers
https://vue3openlayers.netlify.app/
MIT License
629 stars 120 forks source link

Changing url option of ol-source-vector not trigger map reloading in recent versions #357

Closed Athdemond closed 4 weeks ago

Athdemond commented 1 month ago

Describe the bug I'm using "ol-source-vector" in my project with a URL parameter that can be changed when the user interacts with the interface. This is needed to implement switching floors on the building map.

I set url option that way:

const params = computed(() => ({
  service: 'WFS',
  version: '1.0.0',
  request: 'GetFeature',
  outputFormat: 'application/json',
  typeName: 'smvu2:DPbyUUID',
  VIEWPARAMS: `floor_n:${activeFloor.value};uuid:${props.uuid}`,
}));
const url = computed(() => `/geoserver/smvu2/ows?${new URLSearchParams(params.value).toString()}`);

And everything worked well on version 4.1.0. The user clicked the floor buttons and the map reloaded instantly. Code for map:

<ol-vector-image-layer :zIndex="0">
   <ol-source-vector ref="vectorSource" :url="url" :format="geoJson" />
</ol-vector-image-layer>

But now this feature broken. Map doesn't trigger fetch request after url option changed.

Affected version(s)

Tested on vue3-openlayers 8.1.0 and 10.0.0

"ol": "^9.1.0"
"ol-contextmenu": "^5.4.0"
"ol-ext": "^4.0.18"

To Reproduce Steps to reproduce the behavior:

  1. Create ol source vector component with url option
  2. Change url ref/computed
  3. See that map not realoading and request not sent

Expected behavior Map send request to url provided

Desktop (please complete the following information):