Open bgrins opened 1 year ago
Yes, if this fixes Firefox support then we should use it
Sounds good. Depending on how things are accessed, the Cache API in a Service Worker may be a solution to consider as well https://developer.mozilla.org/en-US/docs/Web/API/Cache. I believe this would allow the helper code like loadRemote to always just call fetch() and deal with the Response - with the first time causing a remote fetch and subsequent requests being served from a local cache. This is "best-effort" like IndexedDB which means it could be evicted without notice, but I think would be comparable to the behavior today.
Thanks @bgrins for highlighting this - was straightforward for me to replace IndexedDB with OPFS for caching. Here is a Gist from code snippets that worked for me - maybe it helps someone else. Feel free to use it - I might contribute it back in a few weeks.
https://gist.github.com/tudi2d/ea79d717c1fe27f23f09e66b3f0663cf
Thanks @bgrins for highlighting this - was straightforward for me to replace IndexedDB with OPFS for caching. Here is a Gist from code snippets that worked for me - maybe it helps someone else. Feel free to use it - I might contribute it back in a few weeks.
https://gist.github.com/tudi2d/ea79d717c1fe27f23f09e66b3f0663cf
But createWritable
is not supported in safari. Do we have any work around for that
Thanks @bgrins for highlighting this - was straightforward for me to replace IndexedDB with OPFS for caching. Here is a Gist from code snippets that worked for me - maybe it helps someone else. Feel free to use it - I might contribute it back in a few weeks. https://gist.github.com/tudi2d/ea79d717c1fe27f23f09e66b3f0663cf
But
createWritable
is not supported in safari. Do we have any work around for that
you can use the sync worker api in Safari, Firefox and Chrome: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system#manipulating_the_opfs_from_a_web_worker
OPFS has some nice properties - better persistence, performance, and consistent support for large files across browsers (enabling Firefox support for the larger models).
Would you be open to a change to helpers.js to migrate the backend or do you prefer to stick with IndexedDB?