Uh oh!
There was an error while loading. Please reload this page.
Conversation
✅ Deploy Preview for nuxt3-docs canceled.
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
pi0
commented
Jun 1, 2022
With the |
cawa-93
commented
Jun 1, 2022
@pi0 I have already added 3.api/3.utils/clear-nuxt-cache.md and describe |
| for (const key of _keys) { | ||
| if (nuxt.payload.data[key] !== undefined) { | ||
| nuxt.payload.data[key] = undefined | ||
| } | ||
| if (nuxt.payload._errors[key] !== undefined) { | ||
| nuxt.payload._errors[key] = undefined | ||
| } | ||
| } |
pi0
commented
Sep 7, 2022
Thanks for making PR @cawa-93. I've made few refactors to reflect last changes and also cleaning up shared state. Didn't had a change to try it please share feedback if last changes have any issues or could be improved :) |
cawa-93
commented
Sep 7, 2022
Uncovered use case: clearNuxtData(key=>key.startsWith('posts.list'))Or provide another method to get all keys in cache and filter it manually: clearNuxtData(getNuxtDataKeys().filter(key=>key.startsWith('posts.list'))) |
pi0
commented
Sep 7, 2022
Filter support seems a good idea 👍🏼 When constructing _keys, we can check type and if is function, use Object.keys + filter function. Feel free to make a PR. |
Uh oh!
There was an error while loading. Please reload this page.
🔗 Linked issue
https://github.com/nuxt/framework/discussions/4636
❓ Type of change
📚 Description
Resolves #4636
Added a simple helper function that deletes data from the internal cache by key. This method is useful if you want to invalidate the data fetching for another page.
📝 Checklist