vigetlabs / craft-viget-base

http://code.viget.com/craft-viget-base/
7 stars 3 forks source link

[Craft 4] Investigate why auto-bootstrapping is initializing twice. #54

Open joshuapease opened 2 years ago

matthisamoto commented 5 months ago

Y'all ever figure this one out? Noticed this as well on some inherited work.

joshuapease commented 5 months ago

Hey @matthisamoto! We did resolve this issue.

In our case, we had both the bootstrap() and init() method.

The solution was to remove the init()

Commit: https://github.com/vigetlabs/craft-viget-base/commit/4a1d3a5d8b89d9bf4ffd774d5fde3ca293891d1a

matthisamoto commented 5 months ago

@joshuapease Awesome, yeah I went looking because I was seeing most noticeably in how Sections or Fields appears twice in the CPNav, and I found that not explicitly loading it in app.php eliminates this, presumably because it's now auto-loading (this was on a project we upgraded to Craft 4.x).

That said I don't know that that's the same problem described in this issue, and something you all probably figured out a while back!

joshuapease commented 5 months ago

Was just about to comment about that scenario as well!

This particular issue was happening for new installs.

But you're correct, older versions required that you manually bootstrap the module in app.php or as a sub-module.

Here's some old docs talking about both of those ways of initializing the module. Both can be removed with the Craft 4 version of the base module (since it bootstraps automatically now)