-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resources Middleware Caching and Api Updates #877
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.
|
Type: feature
The following has been addressed in the PR:
prettier
as 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
idKey
to 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 thecreateOption
API has been updated to accept a setter to manage option updatesfind
: The find API has been removed in favour of aget
API that can return items that are loaded in memory. For resources that are in memory theget
API will be the equivilent to using thefind
API 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
: Themeta
API has been removed in favour of a meta flag that can be passed to theget
andgetOrRead
APIsisLoading
: TheisLoading
API has been moved to be part of the meta information that is returned using themeta
flag withget
andgetOrSet
Resource 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