{"action":"closed","issue":{"url":"https://api.github.com/repos/openlayers/ol3/issues/3812","labels_url":"https://api.github.com/repos/openlayers/ol3/issues/3812/labels{/name}","comments_url":"https://api.github.com/repos/openlayers/ol3/issues/3812/comments","events_url":"https://api.github.com/repos/openlayers/ol3/issues/3812/events","html_url":"https://github.com/openlayers/ol3/issues/3812","id":88995658,"number":3812,"title":"Infinite vector layer reload when ol.source.Vector.clear() is called.","user":{"login":"Blackhex","id":23485,"avatar_url":"https://avatars.githubusercontent.com/u/23485?v=3","gravatar_id":"","url":"https://api.github.com/users/Blackhex","html_url":"https://github.com/Blackhex","followers_url":"https://api.github.com/users/Blackhex/followers","following_url":"https://api.github.com/users/Blackhex/following{/other_user}","gists_url":"https://api.github.com/users/Blackhex/gists{/gist_id}","starred_url":"https://api.github.com/users/Blackhex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blackhex/subscriptions","organizations_url":"https://api.github.com/users/Blackhex/orgs","repos_url":"https://api.github.com/users/Blackhex/repos","events_url":"https://api.github.com/users/Blackhex/events{/privacy}","received_events_url":"https://api.github.com/users/Blackhex/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-17T11:53:24Z","updated_at":"2015-07-15T13:37:57Z","closed_at":"2015-07-15T13:37:57Z","body":"Consider the following example in OpenLayers 3.6.0:\r\n\r\n    var geoJsonFormat = new ol.format.GeoJSON();\r\n    var vectorSource = null;\r\n    \r\n    function loaderFunction(extent, resolution, projection) {\r\n      var from = ol.proj.transform([extent[0], extent[1]], 'EPSG:3857', 'EPSG:4326');\r\n      var to = ol.proj.transform([extent[2], extent[3]], 'EPSG:3857', 'EPSG:4326');\r\n      var url = \"http://example.com/test?bounds=\" + from.concat(to).join(',');\r\n      jQuery.ajax({\r\n        url: url,\r\n        success: function (data) {\r\n          var features = geoJsonFormat.readFeatures(data, {\r\n            dataProjection: 'EPSG:4326',\r\n            featureProjection: 'EPSG:3857'\r\n          });\r\n          vectorSource.clear(true);\r\n          vectorSource.addFeatures(features);\r\n        }\r\n      });\r\n    }\r\n    \r\n    vectorSource = new ol.source.Vector({\r\n      format: geoJsonFormat,\r\n      loader: loaderFunction,\r\n      projection: 'EPSG:4326',\r\n      strategy: ol.loadingstrategy.bbox\r\n    });\r\n    \r\n    var map = new ol.Map({\r\n      target: 'map',\r\n      layers: [\r\n        new ol.layer.Tile({\r\n          source: new ol.source.OSM()\r\n        }),\r\n        new ol.layer.Vector({\r\n          source: vectorSource\r\n        })\r\n      ]\r\n    });\r\n\r\nWhen the `loaderFunction()` success callback contains line `vectorSource.clear(true);` regardless if the paremeter is `true` or `false`, the layer is infinitely reloading even when the camera position and zoom is not changing. When this line is removed the infinite reload is not looping but obvisously the features are multiplying in the layer."}}