Closed stefan-mihaila closed 4 years ago
I just realised that I should also replace the dispatch(newMessage) in messagesSlice. There's a circular dependency though. Looking into it, will update.
I pushed force. I just left the [newMessage] extraReducer in place and called fetchBalance() from it to avoid addressing the circular dependency between walletSlice and messageSlice. @johncantrell97 let me know if that's okay, or if you have another suggestion.
few minor comments otherwise looks good to me. were you able to test it out a bit manually at least?
Yes, I did test it manually (only with Polar though) and it does seem to work fine. I'll address the comments in a bit and add you on Juggernaut to test it a bit more
@johncantrell97 Since I'm here, I noticed there's a connectWallet in walletAPI also, but that method is not used. What's the logic between the separation between walletSlice and WalletAPI. What belongs where?
@johncantrell97 Since I'm here, I noticed there's a connectWallet in walletAPI also, but that method is not used. What's the logic between the separation between walletSlice and WalletAPI. What belongs where?
Yeah didn't realize that. I adopted the new Redux Toolkit methodology (by creators of redux) for a more opinionated framework for using redux. These slice files are supposed to hold a single slice of state and all the related reducers and actions for that slice.
The "API" files were meant to be functions that act as an API client / interface to some service. In the case of Juggernaut (today) that is mostly supposed to be making the grpc calls.
In a normal web app the API files would contain axios and make standard web requests to the API.
The reducers in the slice should be using the api methods they need to perform the reduction (typically only the async / thunk reducers).
Hope that helps a little bit in explaining the thinking there.
Fixes https://github.com/LN-Juggernaut/juggernaut-desktop/issues/14