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

Fix for multiple cacheId prefixes in the precache handler #720

Merged
merged 3 commits into from
Aug 8, 2017

Conversation

jeffposnick
Copy link
Contributor

R: @addyosmani @gauntface
CC: @HenrikJoreteg @liuruoran88

This fixes #714 by explicitly changing the method call inside of WorkboxSW to indicate that for the internal CacheOnly handler use for precached requests, cacheId shouldn't be prepended when determining the corresponding cache name.

I decided to go with that approach rather than making a chance in the RequestWrapper constructor that checked to see if cacheId was already present in the cacheName, since you could theoretically imagine calling

new RequestWrapper({
  cacheName: 'my-prefix',
  cacheId: 'my-prefix',
}});

In that situation, the user would expect the effective cache name to be 'my-prefix-my-prefix', and we'd want to still allow that.

Copy link

@gauntface gauntface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with the PR going in, but we really need to sanitise the cache naming stuff. Every time I try and reason with it in my head, it quickly falls down to - no idea, it's from the request wrapper, which comes from different places depending on what you are doing and that will depend on what is passed to it.

@jeffposnick
Copy link
Contributor Author

The interplay of cacheId and cacheName, while useful, definitely complicates the logic, too.

@jeffposnick jeffposnick merged commit aad0282 into master Aug 8, 2017
@jeffposnick jeffposnick deleted the fix-multiple-cache-id branch August 8, 2017 14:59
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

Successfully merging this pull request may close these issues.

trouble with precaching when supplying cacheId
2 participants