SwiftUI - List view doesn't get updated even the state gets updated

Hi

I am working on an app which has a list of orders on a view. Order status -received, preparing, ready, complete- gets updated real time via another app. We are using graphql subscription, which order status gets updated, and in my reducer I catch it updated order, and find it in orders array, update with the new order.

What I couldn't figure out is, UI doesn't get updated.

If a new order is created and when I append it, it gets updated.
If an order is completed, and when I remove from array, it gets updated.

However if order is not needed to append or remove, just update then nothing happens even order is updated in the array in the state. I need to leave the page, and come back again to see updated.

I even copied the order to be updated to update its status after updated order comes from catchtoeffect has different id(UUID),
Still didn't work.
I even tried remove at index, and insert at index, still didnt get updated.

What is the best approach for this scenario?
I tried ForEachStore, binding, after 3 days, I started to confuse myself.

Which example in the SCA case studies help me?
Thanks

App is Tab bar app, if I go to another tab and come back, I see the it is updated.

I have done something that no one will approve I believe :D

I added a Bool property, everytime update happens, I toggle that. it works :smile:

I like to know correct way but still not a blocker for me.

Terms of Service

Privacy Policy

Cookie Policy