feat: useWizardApiFetch
add manual cache handling logic
#3480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
useWizardApiFetch
caches in 3 ways:GET
requests for specificpath
s.updateCacheKey
: Useful when different requests share the same response/cache schema.updateCacheMethods
: Useful when requests share the samepath
and response/cache schema.The problem:
There are certain scenarios where return structures do not align with the cached object. These situations require either more configuration inside
useWizardApiFetch
or providing an API for directly interfacing with it, this PR introduces the latter.Additionally, changes where made to fix how paths are stored as cache keys by removing query arguments.
How to test the changes in this Pull Request:
git checkout origin/feat/manual-cache-logic && npm run build
to
npm run watch|build
and navigate to /wp-admin/admin.php?page=newspack-settings#/display-settings<button>
, you should see below.Other information: