Resources Middleware Caching and Api Updates#877
Merged
agubler merged 20 commits intodojo:masterfrom Jan 20, 2021
Merged
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 24809c0:
|
Codecov Report
@@ Coverage Diff @@
## master #877 +/- ##
==========================================
- Coverage 94.72% 94.58% -0.14%
==========================================
Files 127 127
Lines 8130 7959 -171
Branches 1894 1859 -35
==========================================
- Hits 7701 7528 -173
- Misses 429 431 +2
Continue to review full report at Codecov.
|
matt-gadd
approved these changes
Jan 20, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Type: feature
The following has been addressed in the PR:
prettieras per the readme code style guidelinesDescription:
As part of the Dojo 8, the dojo resources middleware has been overhauled in order to support upcoming functionality such as creating and editing resources, custom resource apis and caching options.
Template Api Changes
Template are now required to specify an
idKeyto indicate which property of the data is considered the unique id. This is to enable future work such as save/create.Templates that require options (previously called
initOptions) are not defined as a function with the options as the single parameter. These options are passed by the user when the template is used.The result can be used with the resource api or with the resource widget property.
Resource Api Changes
These changes have refined the API based on using resources, providing fine grained meta details and control into individual item states.
createOptions: Update thecreateOptionAPI has been updated to accept a setter to manage option updatesfind: The find API has been removed in favour of agetAPI that can return items that are loaded in memory. For resources that are in memory thegetAPI will be the equivilent to using thefindAPI for resources where the entire dataset isn't loaded it's unlikely that remote APIs would have support to return the needed information for find to work successfully and tend fallback to searching in memory (aka usingget)meta: ThemetaAPI has been removed in favour of a meta flag that can be passed to thegetandgetOrReadAPIsisLoading: TheisLoadingAPI has been moved to be part of the meta information that is returned using themetaflag withgetandgetOrSetResource Property Api Change
The resource property has been updated to include to two shorthand variations
Using the default template
Data can be passed in an object to the resource property that will use the default template by default:
Or the result of a template can be passed:
The caveat is that the template/data must match requirements of the widget, when transforms or options need to be passed the resource middleware needs to be used.
Todo
Resolves #875
Resolves #876
Resolves #849