Questions tagged [optimistic-ui]

Optimistic UIs don’t wait for an operation to finish to update to the final state. They immediately switch to the final state, showing fake data for the time while the real operation is still in-progress.

In an optimistic update the UI behaves as though a change was successfully completed before receiving confirmation from the server that it actually was - it is being optimistic that it will eventually get the confirmation rather than an error. This allows for a more responsive user experience.

26 questions
19
votes
1 answer

Apollo Optimistic UI does not work in Mutation Component?

I am using component which has Render Prop API & trying to do Optimistic Response in the UI. So far I have this chunk in an _onSubmit function - createApp({ variables: { id: uuid(), name, link }, optimisticResponse: { …
deadcoder0904
  • 7,232
  • 12
  • 66
  • 163
7
votes
2 answers

Apollo client: Making optimistic updates while creation is still in progress

I want to be able to do updates on an object while it is still being created. For example: Say I have a to-do list where I can add items with names. I also want to be able to edit names of items. Now say a user with a slow connection creates an…
priomsrb
  • 2,602
  • 3
  • 26
  • 34
5
votes
1 answer

Optimistic React Apollo ui lag with React Beautiful Drag and Drop

I'm trying to create a optimistic response where the ui updates immmediately (minimal lag and better user experience) with drag and dropped data. The issue i'm having however is that it lags anyways. So whats happening is that I expect a list of…
Karan
  • 1,141
  • 2
  • 19
  • 42
4
votes
0 answers

Apollo Optimistic UI - how does it handle an optimistic update after an optimistic create?

Trying to understand conceptually how Optimistic UI works, appreciate any help! Scenario: We send a mutation to create a new User "John" --> Request A We leverage the Optimistic UI feature to immediately return 'fake' data for "John" Fake "John"…
Ray J
  • 805
  • 1
  • 9
  • 13
4
votes
1 answer

Apollo js Subscriptions Optimistic UI

Does it make sense having Optimistic UI with subscriptions? So basically: addChannelMutation({ variables: { name: eventValue }, optimisticResponse: { __typename: "Mutation", addChannel: { __typename: "Channel", id:…
Luca Marangon
  • 762
  • 1
  • 8
  • 13
3
votes
1 answer

Complex Optimistic Updates: How to Handle More Than Just Binary-like Elements

I want to build an optimistic ui, in which I can perform all CRUD operations. For example a todo app in which a user can add, update and delete todo items. However I cannot find any resource that discusses more than just adding items. For…
3
votes
1 answer

Apollo/graphQL: How to use optimistic UI for a mutation of a nested react component?

As shown below I'm getting my data in my nextJS application in the pages/article.js using a graphQL query. This data is passed down to another react component, which gives me a list of checkboxes. Selecting a checkbox is calling a mutation to store…
user3142695
  • 15,844
  • 47
  • 176
  • 332
3
votes
1 answer

Does Meteor.call affect optimistic UI?

When I do a Meteor.call instead of a direct collection manipulation on both client and server. Does it remove the optimistic UI changes, aka minimongo changes and simply does direct to server change and wait for update on server before updating the…
Kelvin Zhao
  • 2,243
  • 3
  • 22
  • 31
3
votes
1 answer

Optimistic Updates Using Flux (async)

I am trying to add optimistic updates to my Flux model. I am smushing the UI action dispatch and the server action dispatch into one action. My code in the action creator looks like this: deleteItem: function(itemId) { // optimistic update …
thealexbaron
  • 1,558
  • 1
  • 11
  • 25
2
votes
1 answer

How to implement the optimistic UI in the case of fe-retching a different query in Apollo v3 React client

I'm trying to implement the Optimistic UI for the like functionality but I can't handle it because of the dedicated query I must re-fetch to update the articles. Let me explain it a bit better via code examples: Here is the article document I…
Velidan
  • 5,526
  • 10
  • 48
  • 86
2
votes
2 answers

Optimistic UI Not Updating - Apollo

After making a mutation the UI does not update with a newly added item until the page is refreshed. I suspect the problem is in the update section of the mutation but I'm not sure how to troubleshoot further. Any advice is much appreciated. Query…
kybak
  • 820
  • 3
  • 13
  • 28
1
vote
1 answer

Loading state before display new content

I'm trying to achieve optimistic UI loading with react and redux. This is my reducer: const initState = { user: {}, loading: true, }; export default function (state = initState, action) { switch (action.type) { case…
Nemus
  • 3,879
  • 12
  • 38
  • 57
1
vote
1 answer

Apollo, optimistic creation, and redirection

I am facing some troubles with my GraphQL optimistic rendering. I'm using Apollo Client, such as: const history = useHistory(); const [addItem] = useMutation(ADD_ITEM_QUERY); const onClick = () => { addItem({ variables: { …
Jonathan Petitcolas
  • 4,254
  • 4
  • 31
  • 42
1
vote
1 answer

Implementing Optimistic UI in Java

So I'm reading about Optimistic UI and it's something I would like to implement in my android java app. My android app connects with my rest api. My confusion is how do I go about this? I have a products api that I call from the android app to save…
user3718908x100
  • 7,939
  • 15
  • 64
  • 123
1
vote
1 answer

Meteor's optimistic ui broken, when Meteor.publish with "createdAt: {$gte: start, $lt: now}"

Story: I've used meteor 1.4 with angular 1. And I want to make "Todo" private by using Meteor.publish, here is the client code: var now = new Date(); var start = new Date(); start.setHours(0, 0, 0, 0); this.helpers({ todos() { return…
Nicolas He
  • 43
  • 7
1
2