Closed neozhu closed 1 year ago
Can you provide a repro, please.
this project for your testing https://github.com/neozhu/CleanArchitectureWithBlazorServer/tree/fluxor Of course, you can also refresh the page multiple times in your project and it should also report an error
I believe I am seeing the same issue in my Blazor Server app. I went through all the points in https://github.com/mrpmorris/Fluxor/blob/master/Docs/disposable-callback-not-disposed.md and wasn't able to fix the problem. The app is working fine until I hit the browser refresh button, which causes the exception being thrown as described in initial post. I can try to help here with a PR or further analysis, but I would need some guidance on how to tackle this. If you can share a few hints on how to approach this I can try to further analyze and contribute a PR if required.
@codedevote I have already resolved the issue by adding a FetchDataAction to query the state during component initialization. Let me know if you have any further questions.
@codedevote I have already resolved the issue by adding a FetchDataAction to query the state during component initialization. Let me know if you have any further questions.
@neozhu Can you please explain what the root cause of the problem was and how it was solved by adding a FetchDataAction? It sounds like there was something missing at that point when it was refreshed? I do have an action that initializes state in the beginning, though I am not sure, what could be still wrong on my end. Thanks for your response, I really appreciate your help.
@codedevote Please review my code on GitHub at https://github.com/neozhu/CleanArchitectureWithBlazorServer/tree/main/src/Application/Features/Fluxor for a better understanding of how the issue was resolved. Let me know if you have any further questions.
@neozhu what did you do, and why does it work?
My scenario is as follows: I have a UserProfileState that displays the UserProfile in different Blazor Components. When the UserProfile changes, all Blazor Components are notified to refresh. Originally, I queried the database directly to get the UserProfile when the user logged in or when the page was initialized, and then called IDispatcher.Dispatch(new UserProfileUpdateAction()). This worked fine if the page was not refreshed (F5), but if I refreshed the page with F5, an error occurred. I think the reason is that Javascript is not ready yet. So, when I need to get the UserProfile from the database, I used the Effects example provided in the project to get the data through FetchUserDtoAction and FetchUserDtoResultAction. I think this is the correct approach. Thank you very much.
@neozhu Thanks for response, unfortunately, I am not able to map that to my scenario.
@mrpmorris How would I approach debugging this? I am thinking of cloning the repo and using it as a project reference instead of your nuget packages. I could then add some more tracking code and debug my way through. Any further suggestions are highly appreciated. Thanks.
@neozhu I ran your app and hit refresh multiple times but saw no errors.
Which page should I navigate to, and what should I do once there?
I have fixed it
@neozhu How did you fix it?
DisposableCallback with Id ""StateSubscriber.Subscribe" (created in "C:\Data\Mine\Code\Fluxor\Source\Lib\Fluxor\StateSubscriber.cs" on line 50)" was not disposed. See https://github.com/mrpmorris/Fluxor/tree/master/Docs/disposable-callback-not-disposed.md for more details