Skip to content
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

Passthrough provided meta in identity requests #41

Merged
merged 1 commit into from Jan 19, 2016

Conversation

ryanbrainard
Copy link
Contributor

Identity requests (i.e. requests with value) should also support meta to pass along to along in transformations; otherwise, this metadata gets lost and is not accessible by the component.

@@ -179,7 +179,7 @@ export default function connect(mapPropsToRequestsToProps, options = {}) {
const onRejection = this.createPromiseStateOnRejection(prop, mapping, startedAt)

if (mapping.value) {
const meta = {}
const meta = mapping.meta || {}
this.setAtomicState(prop, startedAt, mapping, initPS(meta))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and made this set the provided meta on the pending PromiseState; however, this is different behavior from the value, which is not set until the PromiseState is fulfilled. I'm not super happy about this, but I think it is the most expected behavior. We can think about setting value up front, but then it's different from regular URL-based requests. Feedback welcome.

cc: @jsullivan @hburrows

@ryanbrainard
Copy link
Contributor Author

Going to pull this in early for the beta, but please review async before this ships in 0.7.0

ryanbrainard added a commit that referenced this pull request Jan 19, 2016
Passthrough provided meta in identity requests
@ryanbrainard ryanbrainard merged commit 2be4192 into master Jan 19, 2016
@@ -26,7 +26,8 @@ Instead, it *returns* a new, connected component class, for you to use.
- `andThen(value, meta): { prop: request, ... }` *(Function)*: returns an object of request mappings to fetch after fulfillment of this request but does not replace this request. Takes the `value` and `meta` of this request as arguments.
- `andCatch(reason, meta): { prop: request, ... }` *(Function)*: returns an object of request mappings to fetch after rejection of this request but does not replace this request. Takes the `value` and `meta` of this request as arguments.
- `value` *(Any)*: Data to passthrough directly to `PromiseState` as an alternative to providing a URL. This is an advanced option used for static data and data transformations.

- `meta` *(Any)*: Metadata to passthrough directly to `PromiseState`. This attribute is only recognized if `value` is also provided.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #42

@ryanbrainard ryanbrainard deleted the fix-identity-request-meta branch February 2, 2016 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant