Csaba Szugyiczki
01/19/2022, 12:27 PMonCheckedChange
callback is called. We launch a request to our server and if it is successful only then we change the actual value that is backing the Switch’s checked state.
If this happens in around 100ms the switch can stuck in an endless loop.
Did anyone have a similar problem? It would be nice if we did not have to touch anything below VM layer to prevent this.Csaba Szugyiczki
01/19/2022, 12:28 PMchecked
value is not updated immediately in the onCheckedChange
callback, then the Switch is animated back to its original state. This animation is running for 100ms, so it is a timing problem within the Swipeable implementationCsaba Szugyiczki
01/19/2022, 12:29 PMCsaba Szugyiczki
01/19/2022, 12:29 PMZach Klippenstein (he/him) [MOD]
01/19/2022, 1:25 PMCsaba Szugyiczki
01/19/2022, 1:31 PMCsaba Szugyiczki
01/19/2022, 2:02 PMZach Klippenstein (he/him) [MOD]
01/19/2022, 2:29 PMCsaba Szugyiczki
01/19/2022, 2:31 PMZach Klippenstein (he/him) [MOD]
01/19/2022, 2:36 PMCsaba Szugyiczki
01/19/2022, 2:43 PMZach Klippenstein (he/him) [MOD]
01/19/2022, 3:04 PMI would flip this conversation and ask why my Repository layer has to conform to the inner workings of my View layerI don’t think this has anything to do with the view layer in the first place, it’s more a matter of eventual consistency extended to the client instead of just between backend nodes. The whole purpose of the repository layer is to try to keep local and remote state in sync – if it has any responsibilities, that is it. Keeping state on multiple distributed nodes in sync is a hard problem, whether it’s between backend database nodes or between client and server. The repository pattern exists to try to isolate the logic for handling that problem from other client code.
These should be as independent and interchangeable as possible.Yes, but that doesn’t mean different layers don’t still have basic contracts that they need to satisfy in order to make sense. In fact, this is the exact reason I’m arguing that this logic doesn’t belong in the view layer, or at least in the UI toolkit itself.
This is not an offline first approach but this is an easy to implement and maintain one. The one used in Firebase is better for sure, but it is much more complicated also.Yep, distributed systems are complicated and hard and clients are one part of that. I understand time, staffing, and other resource constraints are a thing. But mixing responsibilities between architectural layers that aren’t intended to handle them will also put a strain on those constraints in the future – it’s a form of tech debt. A UI toolkit that tried to automatically account for lower layers behaving in unexpected ways would be much harder to reason about.
Zach Klippenstein (he/him) [MOD]
01/19/2022, 3:05 PMmyanmarking
01/19/2022, 3:17 PMmyanmarking
01/19/2022, 3:18 PMmyanmarking
01/19/2022, 3:23 PMAdam Powell
01/19/2022, 3:39 PMCsaba Szugyiczki
01/20/2022, 8:14 AMmyanmarking
01/20/2022, 9:25 AMAdam Powell
01/20/2022, 2:50 PMAdam Powell
01/20/2022, 2:54 PMAdam Powell
01/20/2022, 2:57 PMCsaba Szugyiczki
01/20/2022, 3:11 PM