Add note for arguments restriction in query#767
Add note for arguments restriction in query#767iamchenxin wants to merge 1 commit intofacebook:masterfrom
Conversation
|
@steveluscher thoughts on this? The restriction on string arguments is largely arbitrary, how hard would it be to just allow any type? |
|
Thanks for these contributions, @iamchenxin! Instead of warning and documenting (#764) this behavior, how would you feel about fixing it? Here's what needs to happen: Right now, we use the What you could do to fix this would be to modify
Are you up for that? |
|
@steveluscher I am not familiar with Relay yet,and I am learning both Relay and English these days ,So when i make sure i can figure out the meaning of most Relay Store's functions, i should and would do this. Maybe one or two weeks later. |
|
Someone just hit this restriction internally, where their identifying argument was an integer. Relay, as you've noticed above, turned it into a string. If you have time to open Relay up to objects, integer, and string identifying arguments, that would be a tremendous help, @iamchenxin! |
|
@steveluscher Just back from Chinese new year today, i will try to fix it tomorrow . |
|
Hi @iamchenxin ! I had the same problem when I tried to use an integer identifying argument. If you have the opportunity to look into this issue, it would help a lot! Let us know if you need help! |
|
@vdurmont in the process of writing unit test , will pull the code before i go to sleep. |
|
@vdurmont hi,i go to sleep. and update the uncompleted code to a new pull request. (you review them first, check if i got the right idea). |
|
@iamchenxin Thanks for starting the discussion about this! I've created two new PRs that build on these ideas in #894 and #895, so let's continue discussion there. |
Summary:Note: this is inspired by and partially based on iamchenxin's work in #767 and #844. Thanks for the head start! Relay currently assumes that identifying argument values are strings (numbers *sort* of work, but not really). This builds on #894 (which added support to the plugin for parsing/printing literal InputObjects) by allowing identifying arguments to be basically anything - boolean, number, string, or array/object of the the same. Key changes include: - Change the `CallValue` type from mixed to an explicit list of the supported types - Change `forEachRootCallArg` to return both the literal JS value of the argument as well as a serialized key - Change all callers of `forEachRootCallArg` (and some places that manually inspected the identifying arg) to correctly choose between the identifying argument value (i.e. when constructing a query with it) or the identifying argument key (for use with `RelayRecordStore.{putDataID,getDataID}`). - Added tests that the writer correctly creates root records with numeric/object identifying argument values. Closes #895 Reviewed By: yungsters Differential Revision: D3003201 Pulled By: josephsavona fb-gh-sync-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42 shipit-source-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42
Summary:Note: this is inspired by and partially based on iamchenxin's work in facebook#767 and facebook#844. Thanks for the head start! Relay currently assumes that identifying argument values are strings (numbers *sort* of work, but not really). This builds on facebook#894 (which added support to the plugin for parsing/printing literal InputObjects) by allowing identifying arguments to be basically anything - boolean, number, string, or array/object of the the same. Key changes include: - Change the `CallValue` type from mixed to an explicit list of the supported types - Change `forEachRootCallArg` to return both the literal JS value of the argument as well as a serialized key - Change all callers of `forEachRootCallArg` (and some places that manually inspected the identifying arg) to correctly choose between the identifying argument value (i.e. when constructing a query with it) or the identifying argument key (for use with `RelayRecordStore.{putDataID,getDataID}`). - Added tests that the writer correctly creates root records with numeric/object identifying argument values. Closes facebook#895 Reviewed By: yungsters Differential Revision: D3003201 Pulled By: josephsavona fb-gh-sync-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42 shipit-source-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42
No description provided.