Start a new topic

Relational data, offline and angularJs bug / problem

Hi guys,



I'm developing an app for iOS and Android. I'm using AngularJS / Ionic / Phonegap.

Until recently I have not been using the kinvey references, and did embed relational data. Everything was working fine with that.

Now I'm also using kinvey references to save relational data and with that I started to experience bugs/problems with the angularJs kinvey library.

For every query, that also grabs referenced data, there is a slight chance that I encounter this bug:

**Error: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.**

![](https://c3409409.ssl.cf0.rackcdn.com/kinvey.vanillaforums.com/editor/x8/0x8kwz2ewvad.png "")



You can not easily reproduce it. It only happens sometimes and it only happens with queries on collections with kinvey references and it also only happens with the minified version of the kinvey library.

With the much slower non-minified version I didn't encounter any problems, so I guess it is some sort of timing problem.

The current workaround is if it crashes, to use $timeout of 2000 to query again, which has a high chance of working. But even then it might crash again, then I'm asking the user to manually reload.



So this is problem numero uno.



The second problem is, that sometimes when querying a collection with referenced data, kinvey resolves the relations of some entities correct and for some I get the pure reference entry (e.g.):

`{"_type":"KinveyRef","_collection":"teams","_id":"530ac2aacdf09d2f57004d71"}`

That also only happens when working with either cached data or in complete offline mode.



Any ideas?



Cheers,



the SportThing

I feel the second problem might be caused by the first one, as relational data should work offline. Is there any way you could share your code so I can try and recreate the issue you are seeing?
For the 1st problem:

It happens in the browser and with phonegap compiled android apks.



2nd prob. They are in the cache. I have a workaround where I check if I only get the kinvey ref. If yes, then I grab the same entry by id and now it works.

I am not sure what could cause the first problem - are you running inside PhoneGap, or testing in the browser?



For the second problem, I think the referenced documents are not in the cache. Therefore, the raw reference entry will be returned.
Login or Signup to post a comment