Skip to content
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

Extra scripts being added to the pages where newspack-blocks have been used. #779

Closed
divyarajmasani opened this issue Jun 24, 2021 · 2 comments · Fixed by #780
Closed

Extra scripts being added to the pages where newspack-blocks have been used. #779

divyarajmasani opened this issue Jun 24, 2021 · 2 comments · Fixed by #780

Comments

@divyarajmasani
Copy link
Contributor

Describe the bug
wp-i18n, wp-hooks, wp-a11y scripts are being loaded on the front end pages, where newspack blocks are used, instead of the actual dependencies defined in view.assets.php for the block.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new page/post
  2. Add newspack Author Profile block or Homepage Articles block
  3. Preview the page or Update and view the page
  4. Inspect the page using devTools
  5. Observe the scripts being loaded at the bottom of the page
  6. 'wp-a11y', 'wp-escape-html', 'wp-hook', 'wp-i18n' are present

Screenshots
Results with Author Profile block.

Screenshot 2021-06-24 at 1 29 49 PM

Expected behavior
Blocks should load only dependencies defined in dist/{blockType}/view.assets.php. Which in case of Author Profile block is 'wp-polyfill' only.

@divyarajmasani divyarajmasani changed the title Extra scripts being added to pages where newspack-blocks have been used. Extra scripts being added to the pages where newspack-blocks have been used. Jun 24, 2021
divyarajmasani added a commit to divyarajmasani/newspack-blocks that referenced this issue Jun 24, 2021
Due to incorrect assets path, view and editor scripts were loading fallback dependencies. This
resulted in unnecessary scripts being added to the front end as well as wrong dependencies being
added for editor scripts.

fix Automattic#779
@dkoo dkoo closed this as completed in #780 Jul 19, 2021
dkoo pushed a commit that referenced this issue Jul 19, 2021
…ts (#780)

Due to incorrect assets path, view and editor scripts were loading fallback dependencies. This
resulted in unnecessary scripts being added to the front end as well as wrong dependencies being
added for editor scripts.

fix #779
matticbot pushed a commit that referenced this issue Jul 19, 2021
# [1.30.0-alpha.1](v1.29.2...v1.30.0-alpha.1) (2021-07-19)

### Bug Fixes

* **class-newspack-blocks.php:** fixes assets meta file path for scripts ([#780](#780)) ([a37ff23](a37ff23)), closes [#779](#779)
* allow swiper to reinitialize carousel on attribute changes ([#807](#807)) ([cc9fa30](cc9fa30))
* do not initialize swiper instances if component is hidden ([#804](#804)) ([fe599e1](fe599e1))
* **carousel:** preview performance ([#803](#803)) ([e5fc989](e5fc989))

### Features

* **donate:** streamlined block option w/ Stripe ([#784](#784)) ([10bfb0b](10bfb0b))
@matticbot
Copy link
Contributor

🎉 This issue has been resolved in version 1.30.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this issue Jul 19, 2021
# [1.30.0](v1.29.2...v1.30.0) (2021-07-19)

### Bug Fixes

* remove autoload dependency from donation class ([#811](#811)) ([c37c885](c37c885))
* **class-newspack-blocks.php:** fixes assets meta file path for scripts ([#780](#780)) ([a37ff23](a37ff23)), closes [#779](#779)
* allow swiper to reinitialize carousel on attribute changes ([#807](#807)) ([cc9fa30](cc9fa30))
* do not initialize swiper instances if component is hidden ([#804](#804)) ([fe599e1](fe599e1))
* **carousel:** preview performance ([#803](#803)) ([e5fc989](e5fc989))

### Features

* **donate:** streamlined block option w/ Stripe ([#784](#784)) ([10bfb0b](10bfb0b))
* **nrh:** donations handling ([#805](#805)) ([821f6db](821f6db))
@matticbot
Copy link
Contributor

🎉 This issue has been resolved in version 1.30.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants