Closed Bug 1038806 Opened 6 years ago Closed 2 years ago
Avoid calling `init` panel functions twice in Contacts
`initSettings`, `initDetails` and `initForm` could all be called twice (for example by quickly tapping on the settings button inside Contacts) and then the callback would be executed twice, with unexpected consequences.
Assignee: nobody → sergi.mansilla
This patch makes the three init functions (initDetails, initForm and initSettings) self-contained, without the need of external state variables, and avoids the possibility of loading dependencies twice or, more importantly, executing callbacks twice.
Target Milestone: --- → 2.0 S6 (18july)
Comment on attachment 8456275 [details] [review] Github PR Just a couple of nit on the github pr. Could we add unit test to check that we call the functions just once? Thanks!
Comment on attachment 8456275 [details] [review] Github PR Corrected nits and added tests that check that the callback is called twice.
About testing for the function to be run just once, since parts in the contacts test use these methods, it is not possible to test if it is run once, since it has been memoized already. I accept suggestions on how to test it. The only way I see right now is to make an entire new suit only for these cases. Is that acceptable?
Comment on attachment 8456275 [details] [review] Github PR Forwarding the review to Jose to speed up the process.
Attachment #8456275 - Flags: review?(francisco) → review?(jmcf)
As per conversation with Sergi we are going to rely on a simpler solution that does not involve functions that return functions
Target Milestone: 2.0 S6 (18july) → ---
Assignee: sergi.mansilla → nobody
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.