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

Sharing block: ensure that we do not load resources on the frontend unless needed #34108

Closed
Tracked by #19694
jeherve opened this issue Nov 14, 2023 · 1 comment
Closed
Tracked by #19694
Assignees
Labels
[Block] Sharing Buttons [Feature] Sharing Post sharing, sharing buttons [Focus] Performance [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@jeherve
Copy link
Member

jeherve commented Nov 14, 2023

The Sharing Buttons block currently requires the Sharing_Service class:

require_once __DIR__ . '/../../../modules/sharedaddy/sharing-service.php';

As a result, the sharing buttons' CSS gets enqueued, even if you haven't set up any buttons yet.
https://github.com/jeherve/jetpack/blob/193e017dbfbfbdd2b78dd5f843357d1d04892c38/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php#L907-L908

As we continue to iterate on the new block, we'll need to ensure we do not needlessly enqueue those styles.


Epic: #19694

@jeherve jeherve added [Feature] Sharing Post sharing, sharing buttons [Focus] Performance [Block] Sharing Buttons [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Pri] Normal labels Nov 14, 2023
@jeherve jeherve changed the title Sharing: ensure that we do not load resources on the frontend unless needed Sharing block: ensure that we do not load resources on the frontend unless needed Nov 14, 2023
@andrii-lysenko
Copy link
Contributor

Fixed in #34181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Sharing Buttons [Feature] Sharing Post sharing, sharing buttons [Focus] Performance [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

No branches or pull requests

2 participants