-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ObserveQuery / OnUpdate not respecting selection set nested models - returns function instead #13267
Comments
Hi @m9rc1n it looks like you are using So, the function in place of the new record's |
Hi @chrisbonifacio, Thanks for looking into this issue. I see your point. On the other hand, this design decision might cause confusion among end users (i.e. how to use nested fields in subscriptions?) and lead to some race conditions. For instance, if I do:
Then the content will be still Also I was able to recreate this issue using reverse subscription - listening to updates on |
Hi @m9rc1n we're going to classify this as a bug at the moment, as this probably needs some discussion. Returning the relationship before it exists won't be possible via the subscription so we will look into improving this experience, at least avoiding confusion around related data in messages from onCreate subscriptions. |
Hi @chrisbonifacio, sure thing. |
It is worth noting that typescript errors pop up if an onCreate or onUpdate subscription uses a selection set and we try to lazy load the relations because they're not typed as functions. |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
GraphQL API, DataStore
Amplify Version
v6
Amplify Categories
api
Backend
Amplify Gen 2 (Preview)
Environment information
Describe the bug
Nested model is replaced with function after it is delivered by
observeQuery
oronUpdate
.Selection Set setting is not respected by
observeQuery
oronUpdate
.Expected behavior
Selection Set setting will work the same for observeQuery as it does for other functions i.e. get, or list.
Reproduction steps
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: