gatsby-plugin-offline: About options of merge behaviour of workboxConfig.runtimeCaching. (Optios of runtimeCachingMergeStrategy) #29448
Replies: 2 comments
-
I modified the description a bit. I'm thinking of creating a file called If this approach is not desirable, I would appreciate it if you could let me know. |
Beta Was this translation helpful? Give feedback.
-
@shinshin86 FYI this might be obsolete if #31542 gets accepted. With the new version of gatsby-plugin-offline, route handlers will need to be registered via code instead of a This also allows for somewhat more flexibility, as a user of the plugin can decide to include the default handlers |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I'm using gatsby-plugin-offline and I was confused by the merge behavior at first.
I'm not going to write into what I was confused about, because it's the same thing that is talked about in this issue.
#28289
What do you think about incorporating the content of "Proposal A" proposed in this issue (issues/28289) to improve the usability of gatsby-plugin-offline?
I think it will improve the usability of the plugin because it will give users more options without changing the existing behavior.
This is what Proposal A is about.
(The content of issues/28289 is quoted here.)
Give the user an option where one can define how workboxConfig.runtimeCaching should be merged (e.g. "merge" (current behaviour), "replace", or "append" (maybe even "prepend")) + exporting the default handlers object from the module, so that user can require it and doesn't have to copy the code into his own config.
Usages would the look like:
Append a custom handler
Result:
Defining your own handlers
Result:
Modifing default handlers
Result:
I think for this approach, a default value for runtimeCachingMergeStrategy of "append" would be the most intuitive for users. However, a default value of "merge" would preserve the current behaviour
I am trying to create a pull request to add this option.
If you have any comments, please let me know.
@kije I am trying to add an option based on your Proposal A.
Please let me know if you have any comments.
Beta Was this translation helpful? Give feedback.
All reactions