A small pro tip for devs who are using WordPress Sage9/10 for theme development. I saw many devs doesn't realize that when you are creating View composer and doing stuff inside it, like calling internal functions or executing SQL, for example:
It will be executed as many times as blade files are involved, for example:
protected static $views = [ '*', ];
get_bloginfo() for all blade files.
You should make use of singleton for this, inside
ThemeServiceProvider.php register method add:
Where App::class is view composer class, from now on, service container will not load this class if it's already loaded.