Closed gartorware closed 7 years ago
Hi @gartorware, thanks for reporting this issue! I can confirm that this is a bug and I'll be working on fixing it.
Is there an update on this issue? I have added an SO question for this issue before stumbling upon this page.
Thank you for your help and good work
Hi Adrian, any thoughts on the above bug?
Hi @gartorware and @pomifm, I've done a bit of research and I'm able to reproduce the bug with fewer actions:
Also, I can see this data inside IndexedDB at step 5:
I'm thinking the issue may be related to the processWrites
method. This issue is a bit tricky, but hopefully we're a few steps closer to solving it!
potentialListRef was being set to '//groceries' instead of '/groceries'.
private addToEmulateQue(cacheItem: CacheItem) { // add matches to que
// Check if root level reference
console.log('addToEmulateQue');
const refItems: string[] = cacheItem.ref.split('/');
console.log('addToEmulateQue:refItems1>', refItems);
refItems.pop();
console.log('addToEmulateQue:refItems2>', refItems);
// const potentialListRef: string = '/' + refItems.join('/');
const potentialListRef: string = refItems.join('/'); <=======
if (potentialListRef !== '/') {
// Add
console.log('addToEmulateQue:Add>', potentialListRef);
if (!(potentialListRef in this.emulateQue)) {
this.emulateQue[potentialListRef] = [];
}
console.log('addToEmulateQue:emulateQue>', this.emulateQue);
this.emulateQue[potentialListRef].push(cacheItem);
}
}
hth Tim
This should be fixed in version 4.2.2! 🎉 🎉 🎉
You can test it out using the demo
@tja4472 let me know if you still see //groceries
showing up with the new version.. I haven't spotted the same issue so far. Thanks! 👍
First, I would like to say thank you very much, I think your work is amazing.
Cache is not working properly when you reload while offline. This can be reproduced in the official demo.
Steps to reproduce
The funny part is that write cache is working rightly almost always (updates are synced back even when not appearing in UI), but read cache don't. Maybe this is not a bug and is just how the firebase offline sync mechanism works.
If you watch the localforage db, you can see how write node is updating properly but read/object and read/list nodes don't.
Reloading twice while offline may not be very smart in a web page, but it is pretty common in a (hybrid) phone APP or PWA.
BTW, I have reproduced it in my environment as well:
Sorry for my English.