Open RyanP13 opened 8 years ago
Same issue here. It happens when I use $localforage on a promisified resolved service.
Same problem here with a very similar setup to RyanP13.
For what it is worth i solved this in a hacky way by checking the window.localStorage
object to see if my storage key was present. If not found then define the store. Not pretty:
function configureLocalForage(){
var isStoreDefined = false;
for (var key in window.localStorage){
if(key.match(/^ttn\/[a-z0-9]*/gmi) !== null){
isStoreDefined = true;
}
}
if(!isStoreDefined){
$localForageProvider.config({
driver: localforage.LOCALSTORAGE,
name: 'ttn',
storeName: 'keyvaluepairs'
});
}
}
Can someone make a minimal reproduction case for this? I'm not sure I follow the issue, as I've never seen this in my own usage.
I am getting this issue in my angular application.
The local forage provider is configured in the config block like so:
Once a user is logged in there is a browser refresh timer which triggers on an hourly basis.
When that happens the config block will run again and throw the following error in the localforage JS file because once logged in we try to resolve the logged in user on that route. It seems from localforage JS that in line 1186:
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly')
The db is not yet defined. When i check that the data is there in local storage from the window object it is definitely stored there.
Is this expected behaviour?