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

Remove unnecessary deps when using widgets #1867

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

Soare-Robert-Daniel
Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel commented Sep 14, 2023

Closes #1665

Summary

Using 'dynamic_sidebar_params' we can identify the used widgets in the page. The great changes is that we need to run the assets loading in wp_footer since that filter will not run during 'enqueue_block_assets'.

Screenshots

2023-09-14_10-49-13.mp4

Test instructions

ℹ️ Use a classic theme like Neve.

  1. In the widgets page, add blocks like Maps, Google Maps, and progress bar in different parts of the widgets section.
  2. Insert a widget in a page and ensure the scripts from another widget section are not loaded.
  3. If you a have widget with a Maps block that load leaflet.js and is not present in page, then that script should be loaded.

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@Soare-Robert-Daniel Soare-Robert-Daniel added the pr-checklist-skip Allow this Pull Request to skip checklist. label Sep 14, 2023
@Soare-Robert-Daniel Soare-Robert-Daniel self-assigned this Sep 14, 2023
@Soare-Robert-Daniel Soare-Robert-Daniel marked this pull request as ready for review September 14, 2023 07:53
@Soare-Robert-Daniel Soare-Robert-Daniel changed the title fix: improve widget asset loading Remove unnecessary deps when using widgets Sep 14, 2023
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Sep 14, 2023
@pirate-bot
Copy link
Contributor

Plugin build for e19da4b is ready 🛎️!

@pirate-bot
Copy link
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 270.87 KB 270.87 KB 0 B (0.00%)
Blocks 1.42 MB 1.42 MB 0 B (0.00%)
CSS 85.34 KB 85.34 KB 0 B (0.00%)
Dashboard 122.55 KB 122.55 KB 0 B (0.00%)
Export Import 83.23 KB 83.23 KB 0 B (0.00%)
Pro 303.4 KB 303.4 KB 0 B (0.00%)

@pirate-bot
Copy link
Contributor

E2E Summary

Typing

Test Average Time (ms) Standard Deviation (ms) Median Time (ms) Quantile for soft limit (%) Quantile for hard limit (%)
Typing 66.07 3.76 65.32 5.26 (60ms) 100 (80ms)
Values above 60ms "0 - 62.33, 1 - 62.51, 2 - 62.93, 4 - 64.30, 5 - 67.96, 6 - 74.20, 7 - 66.45, 8 - 64.13, 9 - 65.32, 10 - 70.20, 11 - 69.16, 12 - 63.81, 13 - 68.60, 14 - 64.38, 15 - 70.38, 16 - 67.83, 17 - 63.06, 18 - 69.97"

@rodica-andronache
Copy link

@Soare-Robert-Daniel everything's working well 👍

@Soare-Robert-Daniel Soare-Robert-Daniel linked an issue Sep 19, 2023 that may be closed by this pull request
@HardeepAsrani HardeepAsrani merged commit ce82c78 into development Sep 25, 2023
32 checks passed
@HardeepAsrani HardeepAsrani deleted the fix/widget-assets-loading branch September 25, 2023 08:28
@pirate-bot
Copy link
Contributor

🎉 This PR is included in version 2.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Oct 25, 2023
@preda-bogdan preda-bogdan mentioned this pull request Nov 28, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist. released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assets are enqueued for widgets not visible on the page
4 participants