diff --git a/addon/mixins/fastboot-adapter.js b/addon/mixins/fastboot-adapter.js index 03ce4ba3..ad3cb59d 100644 --- a/addon/mixins/fastboot-adapter.js +++ b/addon/mixins/fastboot-adapter.js @@ -72,10 +72,10 @@ export default Mixin.create({ const maxAgeMinutes = config.storefront ? config.storefront.maxAge : undefined; if (!isFastboot && box && box.queries && Object.keys(box.queries).length > 0) { - const valid = this.isDateValid(box.created, maxAgeMinutes); + const shouldUseShoebox = maxAgeMinutes === undefined || this.isDateValid(box.created, maxAgeMinutes); let key = shoeboxize(cacheKey([type, url.replace(/^.*\/\/[^\/]+/, ''), params])); - if (valid) { + if (shouldUseShoebox) { payload = box.queries[key]; } delete box.queries[key]; diff --git a/tests/dummy/app/pods/docs/guides/fastboot/template.md b/tests/dummy/app/pods/docs/guides/fastboot/template.md index 57e4278d..a9e9df46 100644 --- a/tests/dummy/app/pods/docs/guides/fastboot/template.md +++ b/tests/dummy/app/pods/docs/guides/fastboot/template.md @@ -43,6 +43,8 @@ Fastboot rendered pages need to be generated quickly, since they are rendered on In certain cases, like the browser restoring its session, a cached version of the index.html page may be served, which contains shoebox data from the initial, cached request. The adapter is not aware that this data is stale, and outdated information is displayed to the user. To prevent this you can configure a duration after which data will no longer be served from the shoebox. +If the `maxAge` is not set, by default data will always be served from the shoebox. + ``` // config/environment.js ENV = {