Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

AnthonySoler/controllerim_issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scenario

Dev environment (OK)

Run yarn start and open http://localhost:3000.

Open the DevTools console to see the following traces:

OK  HeaderComponent.js:19
OK  MenuComponent.js:19
OK  MenuComponent.js:28

Prod environment (KO)

Run yarn build then serve -s build Open http://localhost:5000.

Open the DevTools console to see the following traces:

OK  HeaderComponent.js:19
OK  MenuComponent.js:19
KO  MenuComponent.js:31

Controllers tree

ApplicationController
|
|- HeaderController
   |
   |- MenuController

First analysis

Controllerim uses constructor.name as key for controllers. In this example, after the minification process, the controllerName value is equal to "t" for every controller.

So in the MenuComponent, the this.controller.getParentController(HeaderController.name) is equivalent to this.controller.getParentController('t'). In the getControllerFromContext function of controllerim, this name is used to find the related controller and return the first one which match this name. In our case, it will be ApplicationController whereas we want to retrieve the HeaderController and so the following verification failed.

if(headerController.iAmHeaderController) {
    console.log('OK');
}
else {
    console.error('KO');
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published