Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    hrln
    @hrln
    this seems like a really common need, so i feel like i'm missing something - any advice welcome! (and i'll try to pay it forward with what i learn)
    Christian Tietze
    @DivineDominion
    @hrln the error should only appear when you dispatch from multiple queues. Assuming you dispatch on the main queue by default, DispatchQueue.main.async without a delay should do the trick just as well since the main queue finishes one run loop run, which in your case would be the state mutation, before the next thing is processed.
    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
    Capture d’écran 2021-02-25 à 11.23.24.png
    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? :)
    Marco Boerner
    @marcoboerner
    Ahh basically described here: ReSwift/ReSwift#461 Never mind then :)
    Malcolm Jarvis
    @mjarvis
    @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 :)
    Christian Tietze
    @DivineDominion
    Christian Tietze
    @DivineDominion
    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.
    Daniel Bergquist
    @BergQuester
    👋
    Christian Tietze
    @DivineDominion
    :wave:
    Christian Tietze
    @DivineDominion
    Help wanted from folks with GH Actions experience: ReSwift/ReSwift#484
    Daniel Bergquist
    @BergQuester
    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. :-)