Reorderlist not updating
The good news is that as far as your reducer is concerned, fake and real return values are handled just the same, it will simply process two successive updates instead of a single one.So far we’ve only looked at general patterns, but how do you actually implement all these checks, filters, and sorts?First, should you even be inserting the document in the first place?Let’s imagine you have two lists of , it should obviously only go into a single list (it’s an action movie, in case you can’t tell from the title).This gives us our reducer’s first job: making sure new documents belong to the current query before adding them.But we’re not done yet: let’s suppose our movies are listed alphabetically.The method call returns a string of HTML that is inserted as the children of the target element.When I first started using Meteor a few years ago, one of the most impressive features was its seamless and reactive data updates.
But Apollo also offers optimistic updates, in which the client “fakes” the mutation’s return value as soon as the operation triggers, and automatically corrects it with the real server response later on if needed.
Finally, the immutability helper library (previously React’s update) can also be helpful to actually perform the insertion or modification.
Due to the way Java Script handles arrays, returning a sorted array doesn’t actually do anything unless you explicitly create a object.
First, it’s important to understand that Apollo gives you many tools to handle data updates, and that it’s up to you to select the best one of your needs.
The easiest way to handle updates is specifying the refetch Queries options on your mutation.
Search for reorderlist not updating:
And I have to confess that when I ported Vulcan (our new React/Graph QL app framework) from Meteor’s publications/subscriptions system to Apollo’s Redux-based client, I had quite a few “oh right, this doesn’t work automatically anymore! This is especially true when it comes to dealing with mutations, in other words operations such as inserting, editing, and removing documents.