Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Safari, NotFoundError is thrown when svg is cached #10

Closed
boompikachu opened this issue Feb 26, 2022 · 10 comments
Closed

In Safari, NotFoundError is thrown when svg is cached #10

boompikachu opened this issue Feb 26, 2022 · 10 comments

Comments

@boompikachu
Copy link

This error doesn't occur in Chrome

Error message:
NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found

image

No error if data-cache="disabled" is included in the svg tag

Seems to relate to jakearchibald/idb-keyval#134

@shubhamjain
Copy link
Owner

Sorry, haven't caught with issues for some time. Are you still facing this. I wasn't able to reproduce on my safari (both mac and iOS)

@honzabilek4
Copy link
Contributor

I can confirm that the issue still exists.
I don't know exactly how this state occurs, but I was getting the same error when the keyval-store already existed.
It was empty and I wasn't able to run any operations on it. It's definitely related to jakearchibald/idb-keyval#134.
Anonymous window, or deleting the DB helped.

@shubhamjain
Copy link
Owner

Probably makes sense to solve it to cover #13 as well. If IndexedDB doesn't work, localStorage can be tried. LocalStorage has a limitation of 5MB but that should still be good enough for the cases where IndexedDB doesn't work.

The error though shouldn't affect loading of icons. Only that caching won't work for subsequent loads.

@honzabilek4
Copy link
Contributor

Well, there's something wrong with the idb indeed and it sure affects the loading of the icons. The keyval-store is sometimes stuck, not responding to any commands and the icons won't load in Safari.

Sorry that I'm not providing any more details here, but I don't know how to reproduce it yet.

Screenshot 2022-06-01 at 11 01 32

@honzabilek4
Copy link
Contributor

honzabilek4 commented Jun 1, 2022

Just in case you'd like to replace the storage system, I did it here with Sfirr
It also falls back to localStorage and if no localStorage is available it falls back to the memory cache which is exactly what we needed.
Works like a charm, and I can submit a PR if you wish.

@shubhamjain
Copy link
Owner

@honzabilek4 Thanks Siffr looks good! I would appreciate the PR. But I don't think we need WebSQL Storage (a dead API) and Cookies (bad for caching files). Although the library is tiny, I think it can be made even tinier, so we can consider including the library as a folder and remove the stuff that's not needed.

@honzabilek4
Copy link
Contributor

honzabilek4 commented Jun 2, 2022

I was thinking the same but needed to make it work quickly. It won't be difficult to it cut to the essentials and include it in the lib folder directly. Also, the CommonJS import is a little bit awkward. Please give me some time to get back to it, I'll submit a PR.

@shubhamjain
Copy link
Owner

@honzabilek4 Any progress on this? If not, I can initiate work on it.

@honzabilek4
Copy link
Contributor

honzabilek4 commented Jul 5, 2022

Hi,
I'm sorry, I was on vacation 🌴
I see that you've already implemented the localStorage fallback and updated the idb-keval library. It seems that they added this workaround for Safari, which should solve the issue.
Give me a day to test it, and I suppose we can close this.

@honzabilek4
Copy link
Contributor

Works fine on my end right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants