Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

feat(nuxt): Feature/add initialCache option in runtimeConfig.app - #7807

Closed
TheDutchCoder wants to merge 3 commits into
nuxt:mainfrom
TheDutchCoder:feature/add-intialCache-option
Closed

feat(nuxt): Feature/add initialCache option in runtimeConfig.app#7807
TheDutchCoder wants to merge 3 commits into
nuxt:mainfrom
TheDutchCoder:feature/add-intialCache-option

Conversation

@TheDutchCoder

Copy link
Copy Markdown
Contributor

Note: mainly looking for feedback on:

  1. Is this a welcome change?
  2. Did I do it right?
  3. Did I update the docs appropriately?
  4. Do I need to add more docs (probably)?

I don't want to waste your time, so feel free to close this if it's an unwanted addition!

🔗 Linked issue

Currently not an open issue, but a started idea/discussion. I can make a related issue, but first wanted to run this by you guys.

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Currently, all data is fetched with { initialCache: true } as the default setting. This setting can't be changed on a configuration level, which means people have to set { initialCache: false } on every single query if they don't want caching by default, which is cumbersome.

This setting will allow people to specify a default caching strategy on a config level:

exportdefaultdefineNuxtConfig({runtimeConfig: {app: {initialCache: false}}})

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox

Copy link
Copy Markdown

CodeSandbox logoCodeSandbox logo Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify

netlifyBot commented Sep 24, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commitc9a22bb
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/632f639c1fa5cd0008fd39d5

@TheDutchCoder
TheDutchCoderforce-pushed the feature/add-intialCache-option branch from ba471ea to 82e69d4CompareSeptember 24, 2022 17:45
@TheDutchCoder

Copy link
Copy Markdown
ContributorAuthor

This obviously doesn't work yet, I'm probably approaching the config part wrong.
Will try to make it work so the tests pass, and add a new test case if I can!

@TheDutchCoder

TheDutchCoder commented Sep 24, 2022

Copy link
Copy Markdown
ContributorAuthor

Ok, it works properly now, but I'm lost with the tests. Not really sure how they work under the hood.

@pi0

pi0 commented Nov 10, 2022

Copy link
Copy Markdown
Member

Thanks for PR. Planning to drop initialCache and disable it by default (#8885).

BTW supporting global options that change behavior might be tricky. If a Nuxt module or library depends on default behavior, it can be broken easily.

@pi0pi0 closed this Nov 10, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@TheDutchCoder@pi0@danielroe