Refresh should refresh file hashes by clearing the memoized hashes#30
Conversation
|
Thanks for the PR. Can you add a test for |
|
I couldn't find a way to access the content of the memoized hash cache programmatically in the test, so I create/modify a file under |
|
That should do the job, thanks.
Only this I'd like but it's not a blocker is to not use the sync functions.
But perhaps someone will tackle this later along with the core.
…On Mon, Mar 25, 2019, 16:50 Erwan Ameil ***@***.***> wrote:
I couldn't find a way to access the content of the memoized hash cache
programmatically in the test, so I create/modify a file under /test to be
able to observe a new versioned path and compare it to one generated before
a refresh() call.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAVVtSAOebaCkYWTvAxgWhj4ngChha5dks5vaOJOgaJpZM4cGx2Z>
.
|
|
I've changed the test to use async filesystem function. Like this? |
|
I'd say just revert the last patch for now, because we have nested callbacks. Maybe with async/await later someone we'll tackle all of those including core :) |
aa60aae to
80d747e
Compare
|
Hi, do you need me to do anything else in that PR, or should I just wait for whenever you have some free time to check & review it? |
|
Oh, sorry, I wasn't notified about your last force push. I will try to have a look in the next days. |
|
|
||
| const staticifyObj = staticify(ROOT); | ||
| const versionedPath = staticifyObj.getVersionedPath('/test/variable_file.txt'); | ||
| const versioned = versionedPath.split('.'); |
There was a problem hiding this comment.
Any reason you are splitting this here?
There was a problem hiding this comment.
No particular reason expect for the fact that I copied it from the .getVersionedPath test.
|
Thanks! I'm gonna release this later today. |
I've hit an issue where I wanted my express server to return the new paths of javascript/css assets on livereload (for example, first load
/main.df75ab9.js, after livereload/main.db7a554.js).However for now staticify will keep the original hashes in its cache for a filename, even after the file changes and the use of
staticify.refresh(), thus preventinggetVersionedPathfrom returning the newshortHashfor a filename.This PR makes sure that we clear the memoized cache of filename-to-hashes in
refresh(), so that files that have changed and have new hashes can have their new shortHash-paths returned bygetVersionedPath.