Leaflet.TileLayer.PouchDBCached icon indicating copy to clipboard operation
Leaflet.TileLayer.PouchDBCached copied to clipboard

Not compatible with PouchDB v6.x.x

Open piehei opened this issue 9 years ago • 13 comments

Hey

The changes in PouchDB 6 have broken the plugin. https://pouchdb.com/2016/09/05/pouchdb-6.0.0.html

Populating the cache works differently now as per the documentation: Remove db.put(doc, id, rev) Please use db.put({_id: id, _rev: rev, data: 'foo'}) instead

Thanks!

piehei avatar Oct 19 '16 10:10 piehei

Can you send a pull request instead?

IvanSanchez avatar Oct 19 '16 10:10 IvanSanchez

Here how I changed L.TileLayer.PouchDBCached,js for pouchDb 6.0.7 form line 155:

        var doc = {_id: tileUrl, dataUrl: dataUrl, timestamp: Date.now()};

        if (existingRevision) {
            this._db.get(tileUrl).then( function(doc) {
                return this._db.put({
                    _id: doc._id,
                    _rev: doc._rev,
                    dataUrl: dataUrl,
                    timestamp: Date.now()
                });
            }).then( function(response) {
console.log('_saveTile update: ', response);
            });

        } else {
            this._db.put(doc).then( function(doc) {
console.log('_saveTile insert: ', doc);             
            });
        }

        if (done) { done(); }

pcrombach avatar Nov 15 '16 11:11 pcrombach

+1

robindierckx avatar Mar 07 '17 13:03 robindierckx

+1

nikolauskrismer avatar Jun 28 '17 19:06 nikolauskrismer

PR is #32

nikolauskrismer avatar Jul 24 '17 12:07 nikolauskrismer

Demo update PR is #33

nikolauskrismer avatar Jul 24 '17 12:07 nikolauskrismer

+1

brotkiste avatar Oct 19 '17 11:10 brotkiste

Hmm.... PRs were not merged for one year now. If you want to use newer PouchDB versions (like PouchDB 6.x or PouchDB 7.x) check out my fork at: https://github.com/nikolauskrismer/Leaflet.TileLayer.PouchDBCached/

nikolauskrismer avatar Jul 24 '18 11:07 nikolauskrismer

@nikolauskrismer How about I give you the npm privileges to publish this, and you send a PR to the main Leaflet repo to change the link for this plugin? I don't really have the time to maintain it.

IvanSanchez avatar Jul 27 '18 08:07 IvanSanchez

@IvanSanchez: sounds great to me. I can send the PR to the leaflet repo this weekend...

nikolauskrismer avatar Jul 27 '18 10:07 nikolauskrismer

@IvanSanchez: I guess you giving me the npm privileges goes first, doesn't it?

nikolauskrismer avatar Jul 29 '18 12:07 nikolauskrismer

@IvanSanchez: any news on the npm privileges? I updated my repo and tested it with the new 1.3.4 version of leaflet (the plugin works fine again :-))

nikolauskrismer avatar Aug 21 '18 19:08 nikolauskrismer

@IvanSanchez It would be so great if you could transfer ownership of the project to nikolauskrismer!

claudep avatar Apr 15 '21 18:04 claudep