As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
In Safari, WebSQL is used as underlying storage. Do you know the exact Safari version number? I ran the use-case you described, and I get the expected fresh result.
A
A B
said
over 9 years ago
Hello Mark
Just tested on 7.0.3 (9537.75.14) (on laptop)
IOS Webview has the same issue (whatever version is on IOS 7.1)
Just tested by renaming the collection (so its 100% fresh, locally) and still the same problem. This is the code I am using
var query = new $kinvey.Query();
query.equalTo('code', code);
query.limit(1);
var promise = $kinvey.DataStore.find('collection-name', query, {
offline: true,
maxAge: 30,
success: function (response) {
return(response);
}
})
Thanks for looking into it!
A
A B
said
over 9 years ago
OK I think I fixed it
Angular library
maxAge status code
var itemMaxAge = (maxAge || item._kmd.maxAge || 0) * 1000;
rather than
var itemMaxAge = (maxAge || item._kmd.maxAge) * 1000;
I think that occasionally both maxAge and item._kmd.maxAge were NaN and this caused knock on issues. My suggestion above falls back to zero in this situation. (Probably a deeper analysis required as to why both are NaN sometimes!)
A
A B
said
over 9 years ago
Although I have a suggested solution above please do consider testing and integrating into the main angular library so this fix is available for others.....
M
Mark
said
over 9 years ago
I was trying to wrap my head around this, but am so far unable to reproduce. I can certainly add the fix you proposed if you feel AngularJS now works correctly in Safari and iOS Webview.
A
A B
said
over 9 years ago
DELETED as was wrong
A
A B
said
over 9 years ago
DELETED as was wrong
A
A B
said
over 9 years ago
OK going back to the cause of the NaN :)
Current code in Angular library (on the read)
var status = maxAge.status(response);
Function itself in current Angular library
status: function(data, maxAge)
Proposed code
var status = maxAge.status(response, options.maxAge);
i.e. maxAge from the query is not actually being sent to the function (causing a NaN in one of the calcs, if the value is NOT on the data itself)
This removes the NaN on the read and seems to fix it! (ha, yeah, think I said that before)
(Maybe you couldn't recreate this scenario as the data you were testing with had maxAge set on the data itself, in which case you wouldn't see the NaN as that would have been pulled into the function on the data)
If you like this fix and it passes your tests, probably a good one to put in.
M
Mark
said
over 9 years ago
This seems like a bug to me indeed, tests were flaky on this point. This will be incorporated in the next release.
C
Caroline
said
over 9 years ago
This has now been updated! See http://devcenter.kinvey.com/angular/timeline
A B
offline: true, maxAge: 30, Multi-entity query
On Chrome (that uses IndexedDB) if you
a) Do query (so cache set)
b) Change data on Kinvey (via console)
c) Wait a few seconds (i.e. so local data is now over 30 seconds old)
d) You see the new data set in b, when requested from via JS library
On Safari (and on IOS web view), uses a different type of local storage I think
a) Do query (so cache set)
b) Change data on Kinvey (via console)
c) Wait a few seconds (i.e. so local data is now over 30 seconds old)
d) You see the original data, not the new data set in b, when requested via JS library
I would expect Chrome and Safari to work the same. And the Chrome outcome is how I would expect it
Can you confirm that maxAge works (in multi-entity queries) on all styles of local storage you work with?
Thanks!
(maxAge is awesome FYI)