-
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
Data middleware and resource #672
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 cba69a8:
|
}); | ||
afterEach(() => { | ||
resolvers.restore(); | ||
sb.resetHistory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we use this abbreviation elsewhere? sb
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
believe so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adedc32
to
4595172
Compare
This reverts commit 2e41c1b.
939a586
to
8f683d7
Compare
For APIs that do not provide a Additionally it would be beneficial if the data api could be used without providing pagination details, for example if a user wants to return a single resource. Here is an implementation of the HNPWA using data/resources that demonstrates these two scenarios https://github.com/agubler/dojo-resource-hnpwa The resources are defined in |
Type: bug / feature
The following has been addressed in the PR:
prettier
as per the readme code style guidelinesDescription:
Adds a data middleware capable of making widgets data aware and able to deal with a resource.
resource
will be added to the widget's properties. This can be used to pass a resource to be interacted with.createDataMiddleware
function which takes a generic to determine the type of data the widget requires, this adds atransform
function to the widget properties which uses the generic to ensure the correct data type is supplied.Data middleware API interface:
ResourceOptions
are made up of:When a widget using the middleware is destroyed, the middleware will disconnect from the resource.
The Resource will need to provide the following API
Both API
Will work in future with resources.
Resolves #660
Codesandbox of it in use with dummy resource: https://codesandbox.io/s/hardcore-swartz-kezpc