MazeMap / Leaflet.TileLayer.PouchDBCached

A Leaflet tile layer which caches into PouchDB for offline use
MIT License
207 stars 68 forks source link

Using this plugin on a page with mulitple maps generates Document update conflicts #22

Open hrishiballal opened 7 years ago

hrishiballal commented 7 years ago

When using this plugin on a page with more than one map (both maps have same bounds and tiles), on initial sync, it generates a lot of document update conflicts. This is because it is trying to put tiles from two sources at the same time (I think).

To get around it I use the pouchdb.upsert plugin and change the put code to following:

        this._db.putIfNotExists(tileUrl, doc).then(function(res) {
            // success, res is {rev: '1-xxx', updated: true}
        }).catch(function(err) {
            // error
        });

I am not sure if this sort of thing should be in the core library but wanted to raise this.

albfan commented 1 year ago

probably the put code modified link is not valid anymore.

Any chance to upload here at least the diff to test locally?