Title: [EDGE CASE / ANTIPATTERN] Remove observer error Post by: mrichard1 on August 15, 2008, 12:18:14 Hi,
I report to you a bug when I try to remove a mediator, the observers result is null in the View class and removeObserver method. This is normal in my case that the return value is null because I update dynamically the listNotificationInterests in the mediator and one of these was not registered. (I remove and insert it to update this list ) I propose a solution to put in the removeObserver method , if( !observers ){ //correct null error return ; } Thanks. Best regards, Marc Title: Re: Remove observer error Post by: puremvc on August 15, 2008, 05:09:33 Dynamically messing with the observer lists is not a best practice. The framework maintains those lists. This is why Mediators are interrogated for their interests at registration time.
If you change the interests of a Mediator dynamically, then you MUST have its listNotificationInterests method return the *current* interests (NOT the initial interests) at removal time. If you do this, your problem will not occur. If ths had come in yesterday, I would've included it in the 2.0.4 release. Filed under edge-case anti-pattern with workaround for now. -=Cliff> |