There is potentially a lot of time between when the attribute is
checked and when it is finally set. At least the two RessourceLoader
modules need to load. This can take a while, even on fast internet
connections. Just double clicking with the mouse can trigger the code
twice without the attribute being set.
The proposed solution is not the only one, but I believe moving this
single line is the most trivial one.
Bug: T358637
Change-Id: Ic9b99859841439febb83e91f70930e8676a4968a