brianegan / flutter_redux

A library that connects Widgets to a Redux Store
MIT License
1.65k stars 219 forks source link

onDidChange called twice #224

Closed TheCre8tor closed 2 years ago

TheCre8tor commented 2 years ago

onDidChange called multiple times even though distinct is set to true, and sometimes it works as expected.

I thought the issue was coming from my configuration or implementation until I took full Javascript Redux course just to make sure I was doing the right thing, and I was able to resolve the fact that the problem wasn't coming from my end.

I saw a similar issue was opened on 28 Aug 2018, and it hasn't been fixed till date. please can you help us look into it?

I'm also available if you need a hand on this project.

brianegan commented 2 years ago

Hey, thanks for opening the issue. Do you happen to have a code sample that reproduces the problem? In the original thread, the author never responded with a code sample that demonstrates the issue, and I have tests in place to verify this functionality works.

Therefore, perhaps this library has a bug, but I cannot solve a problem if I cannot reproduce it.

On Wed, Nov 24, 2021 at 12:36 PM Alexander Nitiola @.***> wrote:

onDidChange called multiple times even though distinct is set to true, and sometimes it works as expected.

I thought the issue was coming from my configuration or implementation until I took full Javascript Redux course just to make sure I was doing the right thing, and I was able to resolve the fact that the problem wasn't coming from my end.

I saw a similar issue was opened on 28 Aug 2018, and it hasn't been fixed till date. please can you help us look into it?

I'm also available if you need a hand on this project.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brianegan/flutter_redux/issues/224, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA65DBLXBGIOKFXXPWAJSDUNTE4DANCNFSM5IV2YHDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

TheCre8tor commented 2 years ago

Alright, I will but I need to take permission from our CTO before doing so. The application is a Fintech App and it won't be nice if I just expose their code to anyone without a permission to do so.

Thanks for the swift response.

brianegan commented 2 years ago

No problemo! As a heads up, that might not be the best use of time, as that could take several hours for me to get up to speed with your codebase and then have to track down the issue.

Is there any way you could create a separate / smaller sample application that demonstrates the issue or even better yet write a test case that demonstrates the issue?

Furthermore, I just want to check that you have in fact implemented the == method on your "ViewModel" classes. Dart is not like JavaScript, in order for two objects to be equal, you need to write an equals method for each class. We cannot just loop through the keys in an object to make sure they're the same as another object, for example.

On Thu, Nov 25, 2021 at 10:47 AM Alexander Nitiola @.***> wrote:

Alright, I will but I need to take permission from our CTO before doing so. The application is a Fintech App and it won't be nice if I just expose their code to anyone without a permission to do so.

Thanks for the swift response.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/brianegan/flutter_redux/issues/224#issuecomment-979039619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA65DAPPR3HYBISXKCTCT3UNYA2RANCNFSM5IV2YHDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

TheCre8tor commented 2 years ago

No problemo! As a heads up, that might not be the best use of time, as that could take several hours for me to get up to speed with your codebase and then have to track down the issue. Is there any way you could create a separate / smaller sample application that demonstrates the issue or even better yet write a test case that demonstrates the issue? Furthermore, I just want to check that you have in fact implemented the == method on your "ViewModel" classes. Dart is not like JavaScript, in order for two objects to be equal, you need to write an equals method for each class. We cannot just loop through the keys in an object to make sure they're the same as another object, for example. On Thu, Nov 25, 2021 at 10:47 AM Alexander Nitiola @.***> wrote: Alright, I will but I need to take permission from our CTO before doing so. The application is a Fintech App and it won't be nice if I just expose their code to anyone without a permission to do so. Thanks for the swift response. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#224 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA65DAPPR3HYBISXKCTCT3UNYA2RANCNFSM5IV2YHDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Alright, I'm going to create a small project that will demonstrate the bug.

TheCre8tor commented 2 years ago

I use Equatable package on all the classes.

brianegan commented 2 years ago

Heya @TheCre8tor -- hope all is well. Did you happen to narrow this issue down to a test case or sample app that demonstrates the problem?

TheCre8tor commented 2 years ago

Thanks for checking up @brianegan, I have been sick, as soon I get on my feet, I will create a simple app that demonstrates the the problem.

yan-064 commented 2 years ago

Hi,

I had the same problem here. It was due to my ignorance about how flutter works inside, especially about navigation. When I thought that the onWillChange called twice (or more), it was because I open many times the same widget with push navigation. Check out with the devtools if you are not in the same case.