-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent scanning the document when Pattern is just imported #961
Comments
thet
added a commit
to plone/mockup
that referenced
this issue
Feb 17, 2022
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
thet
added a commit
to plone/mockup
that referenced
this issue
Mar 30, 2022
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
thet
added a commit
to plone/mockup
that referenced
this issue
Apr 6, 2022
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
thet
added a commit
to plone/mockup
that referenced
this issue
May 2, 2022
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
thet
added a commit
to plone/mockup
that referenced
this issue
May 17, 2022
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
mister-roboto
pushed a commit
to plone/buildout.coredev
that referenced
this issue
May 17, 2022
Branch: refs/heads/master Date: 2022-05-17T22:46:58+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@abd58f7 maint(Cleanup): Remove pat-content-browser. This can be provided by an external bundle. Files changed: M package.json M webpack.config.js Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:47:03+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@f749505 maint(Cleanup): Cleanup unused parameter in webpack config. Files changed: M webpack.config.js Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:47:03+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@13d0e0d maint(pat querystring): Cleanup - direct import of Select2 is not necessary. Files changed: M src/pat/querystring/querystring.js Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:47:03+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@0a7c631 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 Files changed: M src/pat/relateditems/relateditems.js Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:51:14+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@6aefc4b feat(Build): Use dynamic module federation. Files changed: M package.json M src/index.js M src/patterns.js M webpack.config.js Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:51:14+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@62332d1 maint(Makefile): Add watch-plone and bundle-plone targets to Makefile. Files changed: M Makefile Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:51:14+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@acf9839 maint(Build): Add build:webpack:dev:plone as package.json script to allow for a Plone development build. Files changed: M package.json Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:53:29+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@b354af4 yarn install. Files changed: M yarn.lock Repository: mockup Branch: refs/heads/master Date: 2022-05-17T22:59:38+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: plone/mockup@e795ff4 Merge pull request #1112 from plone/es6-module-federation es6 module federation Files changed: M Makefile M package.json M src/index.js M src/pat/querystring/querystring.js M src/pat/relateditems/relateditems.js M src/patterns.js M webpack.config.js M yarn.lock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a Pattern is imported in JavaScript and it is not yet registered, it will be registered in the Patternslib registry.
If the registry was already initialized the document would be scanned.
We probably want to prevent the auto-scanning when dynamically importing other patterns in JavaScript code.
See the following comment from this commit: plone/mockup@877c83a
The text was updated successfully, but these errors were encountered: