nft-gallery
nft-gallery copied to clipboard
Cache (weird) bug on Firefox
Looks like an old version of https://github.com/kodadot/packages/tree/main/sub-api
Tested both on: https://beta.kodadot.xyz/
Firefox
console
[KODADOT::SUBAPI] LOG: Api already connected at wss://rpc-01.basilisk.hydradx.io
api.isConnected? 💀
Chrome
console
[KODADOT::SUBAPI] LOG: Api already connected at wss://basilisk-kodadot.hydration.cloud
api.isConnected? 💚
any idea where this bug come from? I clear my cache everytime on firefox.
nvm worked after clearing indexDb & cookies
had same in chrome back in July even after updates!
👀
- #2237

And again! (on beta) I don't see "New version" notification :(
Maybe this did not worked as anticipated?
- https://github.com/kodadot/nft-gallery/pull/3834
Maybe this did not worked as anticipated?
I think so 🤔
I found this one https://github.com/GoogleChrome/workbox/issues/3060 even the workbox does not work properly on firefox. step 5 and 6 not working in firefox on this demo https://glitch.com/~workbox-core
IndexedDB and workbox only partial support on firefox
I've just closed "Close to update" popup and got this, maybe some unrelated fluke, but still weird:

I've just closed "Close to update" popup and got this, maybe some unrelated fluke, but still weird:
![]()
ah, I got this error also yesterday on Chrome. but I don't know how to reproduce it. same error regarding PostgreSQL: No space left on device
aahh, I just got that error again recently

I've asked SubSquid about PostgreSQL error; I've already seen that one long time ago.
just some thoughts
And again! (on beta) I don't see "New version" notification :(
for this case, who triggering the notification is from the workbox
but even if the user sees the notification, currently flush indexedDB does not work on firefox. because in this PR #3834 using indexedDB.databases(), I just realized it didn't work on firefox. source: https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/databases. quick fix, no need to use indexedDB.databases(). just use indexedDB.deleteDatabase("db-name") instead
after some research, I have some points to address this issue
- I personally prefer to prioritize this issue #3745 and then drop indexedDB support.
- But, if we still want to use indexedDB. I think we need to revisit the cache mechanism. maybe, put the date also in the key. the goal is to auto-revalidate for the user. in case
workboxis not triggering, indexedDB is still revalidated.
code example for no.2:
// by default, put the date when storing data to indexedDB
setCache('hash', data)
// will be stored like this
// key: 'hash-2022-01-20'
// value: data
// today = 2022-01-20
// find cache with key 'hash-2022-01-20'
getCache('hash') // match
// today = 2022-01-21
// find cache with key 'hash-2022-01-21'
getCache('hash') // doesn't exist
by default, the cache only validates for 1 day. how to set cache for n days
// to set cache for 3 days
setCache('hash', data, { total: 3 })
// will be stored 3 times
// key: 'hash-2022-01-20'
// key: 'hash-2022-01-21'
// key: 'hash-2022-01-22'
how to set cache for n months
// set cache for 1 month
setCache('hash', data, { unit: 'month' })
// store cache with
// key: 'hash-2022-01'
// today = 2022-01-09
// find cache with key 'hash-2022-01'
getCache('hash', 'month') // match
// set cache for 3 months
setCache('hash', data, { total: 3, unit: 'month' })
// store multiple cache
// key: 'hash-2022-01'
// key: 'hash-2022-02'
// key: 'hash-2022-03'
but still, I personally prefer point 1
any js command to hack/clear idb? I've encountered a new 🐛

any js command to hack/clear idb? I've encountered a new 🐛
maybe try this one window.indexedDB.deleteDatabase('db-name')
when developing on Chrome, I click this Clear site data button. maybe firefox has this panel also

I've just closed "Close to update" popup and got this, maybe some unrelated fluke, but still weird:
this keeps happening (seemingly) randomly

Looks like there is still some cache
I suspect vue-persist.
Hey, I guess time to figure out these cache issues with browser cache as some people have old endpoint after we've updated snek RPC for example
Looks like there is still some cache I suspect
vue-persist.
hhmm, let me check on this one