-
Notifications
You must be signed in to change notification settings - Fork 32
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
stdTTL not working for release builds (console.dir undefined) #42
Comments
I second this! Please remove this from the package as the package is not working correctly now. For now I have just added: console.dir = () => {} to the top of my index.js file. |
@stijnstroeve @tsgriff Thank you for finding the misplaced For people who are reading this and looking for a fix:I have used In After changing the file I ran diff --git a/node_modules/react-native-cache/dist/cache.js b/node_modules/react-native-cache/dist/cache.js
index fe6824d..6d5eeef 100644
--- a/node_modules/react-native-cache/dist/cache.js
+++ b/node_modules/react-native-cache/dist/cache.js
@@ -69,7 +69,8 @@ class Cache {
if (entry) {
value = entry.value;
if (this.policy.stdTTL > 0) {
- console.dir(Date.parse(entry.created));
+ // Do not call console.dir
+ // console.dir(Date.parse(entry.created));
const created = entry.created ? Date.parse(entry.created) : 0;
const deadline = created + this.policy.stdTTL * 1000;
const now = Date.now(); |
@timfpark any chance of this being fixed for real? |
Still an issue |
While implementing the stdTTL feature to remove cached entries after expiration, I noticed that entries were successfully removed for debug builds, but not release builds.
The error logged was:
console.dir is not a function. (In 'console.dir(Date.parse(c.created))', 'console.dir' is undefined)
. I traced this to the following code block within thepeek
function indist/cache.js
:if (this.policy.stdTTL > 0) { console.dir(Date.parse(entry.created));
It appears that this could have been added to the dist folder before the version 2.0.2 release since it's not in the repository and was accidentally left in.
Console.dir
is problematic for iOS and Android (facebook/react-native#29300).Could this be removed with another release please? I'd open a PR if it was included with the repo code.
The text was updated successfully, but these errors were encountered: