Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(relateditems): Move Select2 out of init.
If it wasn't already registered, it would register and scan the document now. If there were previous relateditems already modifying the DOM structure and placing pat-select2 classes to some items, the import here would try to initialize them. But those pat-select2 items were meant to be initialized via the Patternslib API and not automatically and are missing some configuration needed by select2 (query attribute...). By moving the Select2 out of the init and importing it early fixes this problem. Note: This happened in plone.app.mosaic with module federation. pat-select2 was already directly imported by the main Mockup bundle. But since we didn't have a global pattern registry, the pattern was re-initialized where it wouldn't have to. Since the change in Patternslib 8.0.0 with a global pattern registry this fix might become obsolete. However, we should have an eye on dynamic pattern imports immediately registering and scanning the docment and possibly prevent that in some way. See: Patternslib/Patterns#961
- Loading branch information