DEV Community

Discussion on: Caching Data in frontend

Collapse
 
akashkava profile image
Akash Kava

LocalStorage and SessionStorage both are synchronous operations and will block browser on large datasets, you must consider IndexedDb over it, and there are shims available with deprecated browser Sql.

Collapse
 
zeerorg profile image
Rishabh Gupta

Thanks for the comment, I did look into it, but I think that it has a bit more complex api. Also Indexed db is aimed at more complex operations like traditional databases whereas session storage is a bit simpler and can handle cache invalidation with session storage.
I am not saying that it cannot be replaced, Indexed db is still a lot better option than managing state itself, and if blocking the main thread becomes a performance bottleneck then it might be worthwhile to look into it.