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

Clarify documentation on Caching #1827

Open
ajcrites opened this issue Sep 14, 2018 · 0 comments
Open

Clarify documentation on Caching #1827

ajcrites opened this issue Sep 14, 2018 · 0 comments

Comments

@ajcrites
Copy link

ajcrites commented Sep 14, 2018

The new babel.config.js allows (seemingly requires) you to set up caching. I think the documentation on caching is a little unclear in a couple of spots:

Any time the using callback returns a value other than the one that was expected...

What is meant by "expected?"

Also, the .invalidate explanation seems to have been copied from the .using section but not updated. I would like to rewrite it, but I'm a bit confused about how invalidate works as well... does it invalidate the cache if it encounters a value different from the immediately previous value? Is it based on a boolean? Will it only invalidate a value that had been used with .using? In that case, how do you use them together?

Finally, the suggestion to use a boolean with .using raises a question -- this will create a cache for values of true and false. Thus it seems like once you have used both these values there is no way to invalidate the cache (without adding a .invalidate or something). I think this should either be specified if my understanding is correct or clarified if it's incorrect.

I think that the error output if you don't set up caching for babel is clearer, at least for .using:

If this function returns a value different from a previously-encountered value...

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

1 participant