menu

Apollo

A community of developers, designers and others who love Apollo and GraphQL. 🚀

Channels
# All channels
view-forward
# General
view-forward
# Apollo Angular
view-forward
# Announcements
view-forward
# Apollo Android
view-forward
# Apollo Client
view-forward
# Apollo iOS
view-forward
# Apollo Link
view-forward
# Apollo Link Rest
view-forward
# Local State
view-forward
# Apollo Studio
view-forward
# Apollo Server
view-forward
# Apollo Tooling
view-forward
# Contributing
view-forward
# Docs
view-forward
# Events
view-forward
# GraphQL Tools
view-forward
# Jobs
view-forward
# Random
view-forward
# React Apollo
view-forward
# Showcase
view-forward
# Subscriptions
view-forward
# Testing
view-forward
# Vue Apollo
view-forward
Team

Mutation returning null for sub table when Foreign Key is changed.

July 24, 2020 at 7:38pm

Mutation returning null for sub table when Foreign Key is changed.

July 24, 2020 at 7:38pm
Hello! I have a button that takes the Id of a Contact from a list and sets it as the FK of a Show table. This Contact is then displayed as the chosen Contact for this particular show. The mutation works and the Show is updated. The problem comes when the mutation tries to query the data back and update the store. All of the data for the Show comes back correctly, but the Contact table comes back null and so the store doesn't update and neither does the UI. If I reload the page, it clearly shows the correct "new" data.
Does anyone have any idea what the problem may be? It doesn't seem to be on the server as the data does in fact update. I've tried refetching the query with the mutation, but it doesn't help. I've tried re-running the original query after the mutation, but I get the same result. Still NULL. Again, once the page reloads, the new data is displayed.
I read something about the query and mutation needing to ask for the same data in order to update properly. I've tried that as well and it hasn't helped.
I'm using Angular 8 with Apollo, this goes to a .Net Core server with Sql Server DB. This problem however seems to be directly associated with Angular Apollo.
Here's my query:
query ($id: ID!) { csw12 (id: $id) { id onsiteContact contactId contact { id contactHat firstName lastName active cellPhone officePhone fax email notes } } }
and Mutation:
mutation updateCSW12 ($show: ShowInput!) { updateCSW12 (show: $show) { id onsiteContact contactId contact { id contactHat firstName lastName active cellPhone officePhone fax email notes } } }
No messages yet