Using 2 dispatch queues in your app is not a problem as long as you remember to return to main. It's a good practice to build components in a way that the caller doesn't notice if the queue/thread/... that work is done on is changed. So if you use a BG dispatch queue for networking, dispatch the result back on the main queue, and don't force callers to take care of that.
hrln
@hrln
appreciate the response @DivineDominion ! i did also try the main queue sans delay, but that didn't help :confounded:
in folks ReSwift setups, are there any techniques you tend to use involving queue management ?
Christian Tietze
@DivineDominion
when the app crashes, you should be able to inspect the stack trace in Xcode to see all active threads and where the culprit might be
e.g. recently we stumbled upon EKEventStore producing results on an Apple-internal, non-main queue to everyone's surprise
hrln
@hrln
thanks again @DivineDominion :slight_smile: ill dig into the stack trace
hrln
@hrln
i took your advice @DivineDominion, digging into the stack track and wrapping calls that completed on a background queue was the ticket :pray:
Christian Tietze
@DivineDominion
💪 great
Mehreen7
@Mehreen7
Hello everyone, i need to show a little text when my app just start, so im trying to add function into my reducer, into "case _ as ReSwiftInit:" but it dont work, can someone help me ? im new to ReSwift
Thank you
Christian Tietze
@DivineDominion
What kind of not working do you experience, @Mehreen7 ?
Mehreen7
@Mehreen7
@DivineDominion Hello, so i have my data save in my postgresql table, and i did all the nodejs api stuff, my request is good i test it on postman but when i try to show it on my app it didnt work, i try to print the data it show me "nil" and when i try to print the state of data in my reducer it show me an empty []
Christian Tietze
@DivineDominion
sorry, that's a pretty generic problem, don't know what ReSwift could have to do with that. Could be anything, starting from your DB response handler not being called
Mehreen7
@Mehreen7
Okay thank you @DivineDominion , i have anoter issue, when I try to add a new opertation in AppThunk the former one are not working anymore
Christian Tietze
@DivineDominion
that doesn't sound right, can you share code?
Mehreen7
@Mehreen7
yes of course
Christian Tietze
@DivineDominion
hmm the async/await is foreign to me, but one thing I notice is you use StoreDispatch instead of the dispatch func that's passed into the Thunk. Might want to quickly change that for starters.
What's not working there? Is the await-block never called? Is the thunk's block not executed when you dispatch?
Mehreen7
@Mehreen7
My "AllDailyMsgActionSuccess" is never called
Christian Tietze
@DivineDominion
ah that's easy, op_5 is not part of the await list of concurrent processes
inside the all(...)
Mehreen7
@Mehreen7
oh no why ?
Christian Tietze
@DivineDominion
you didn't add it? :)
Mehreen7
@Mehreen7
ah yes sorry
_
i try to add it to and change the currency too
but it's still didn't work
and when i add it, my "AllBadgeActionSuccess" is never called
Christian Tietze
@DivineDominion
Sorry, I don't know the async/await stuff here, and that's clearly not a ReSwift problem but something with the concurrency, so I suggest you ask somewhere where more folks hang around for general Swift questions to increase your chances
Mehreen7
@Mehreen7
oh okay thank you so much for your time
Christian Tietze
@DivineDominion
hope that the op_5 thing I pointed out still helps!
Mehreen7
@Mehreen7
Yes ! :) have a good day !
Marco Boerner
@marcoboerner
Hi there! I've just started using the SwiftUI branch of ReSwift. I was using my own Redux implementation before but ran into several issues with the observers. Does anyone know if the SwiftUI branch has a way to filter the observed state? I know SwiftUI should take care of deciding which parts of the view to redraw but it doesn't seem to work very well. Using a single state always causes my whole view to be redrawn and other undesired behaviour. @mjarvis Do you have any information to that? :)
@marcoboerner Sounds like you've found what you're looking for! I'm sorry I've been unable to formalize it more but taking an approach near the bottom of ReSwift/ReSwift#455 should do what you need :)
I'd love to get a second pair of eyes to talk about my ReSwift approaches in 2 apps eventually. If a ReSwift pro is available for hire for an hour here and there, please email :) https://christiantietze.de/contact/
Malcolm Jarvis
@mjarvis
@DivineDominion Happy to help. send me a dm in the ios slack or something to get in touch.
Working with ExpectThunk and running into an issue.
So I have a thunk that conditionally dispatches another thunk.
But Thunks don't play nicely with the .dispatches() assertion
I could breakout out the core functionality into a separate function, but that creates a route to start calling side-effects without going through the thunks.
Put another way: I am testing thunk A which can dispatch thunk B. Asserting that A dispatches B with ExpectThunk().dispatches() doesn't work and it gets in the way of asserting other dispatches() that occur after B is dispatched.
Perhaps I'm thinking about it all wrong and I shouldn't be dispatching thunks from thunks?
Daniel Bergquist
@BergQuester
Just found and tried the .dispatches(dispatch:) function to use a custom dispatch function to assert. That allows me to test thunk B.
Carryon. :-)
Christian Tietze
@DivineDominion
@BergQuester I haven't tested dispatching thunks from within thunks, but it sounds like a common-enough use case. Would it make sense to add an example to the README?