I'm gonna rewrite here what I've written on Discord to have the context of this PR:
DataAdapter.getResourcePath method doesn't have the same behavior on computer and on mobile. While they both returns the absolute path of the resource passed in parameter, the desktop version append a ?mtime suffix at the end, which correspond to the file's modified time. This let the import(fullPath) in API.ts know when the resource can be cached hit or not. Unfortunately since this suffix isn't added on mobile (I'd be interested to know the reason behind this), the import always return the cached version of the file. Thus, only a full reload of the app flush the cache on mobile (I guess)
I think that using getFirstLinkpathDest, to retrieve a TFile of the imported script is the cleanest workaround. That way I can append the TFile.mtime directly at the end of path to optimize cache hits.
I'm gonna rewrite here what I've written on Discord to have the context of this PR:
DataAdapter.getResourcePath
method doesn't have the same behavior on computer and on mobile. While they both returns the absolute path of the resource passed in parameter, the desktop version append a?mtime
suffix at the end, which correspond to the file's modified time. This let theimport(fullPath)
inAPI.ts
know when the resource can be cached hit or not. Unfortunately since this suffix isn't added on mobile (I'd be interested to know the reason behind this), the import always return the cached version of the file. Thus, only a full reload of the app flush the cache on mobile (I guess)I think that using
getFirstLinkpathDest
, to retrieve a TFile of the imported script is the cleanest workaround. That way I can append theTFile.mtime
directly at the end of path to optimize cache hits.