publisher-media-kit
publisher-media-kit copied to clipboard
Tab and tab item blocks are loaded where they are not necessary
Describe the bug
Since version 1.3.4 the plugin always includes the block assets for tabs and tab items. This causes a chain reaction, because of dependencies, that leads to an GET-request for every visitor on the site.
The tabs and tab item blocks both have wp-block-editor
as dependency, which on it's place again has dependencies on wp-preferences
and wp-preferences-persistence
.
wp-preference
has an after script that looks like this:
<script type="text/javascript" id="wp-preferences-js-after">
/* <![CDATA[ */
( function() {
var serverData = false;
var userId = "0";
var persistenceLayer = wp.preferencesPersistence.__unstableCreatePersistenceLayer( serverData, userId );
var preferencesStore = wp.preferences.store;
wp.data.dispatch( preferencesStore ).setPersistenceLayer( persistenceLayer );
} ) ();
/* ]]> */
</script>
which triggers the GET-request. When not logged in, the request fails.
Steps to Reproduce
- Go to https://iculture.nl
- Check the network tab and see a request to https://www.iculture.nl/wp-json/wp/v2/users/me?context=edit&_locale=user is made.
- If you look at the initiator stack, it appears to becoming from the
preference-js-after
script, which is included af terpreferences-js
.
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct