How to render HTML content using the Interactivity API?

Rather than binding text with a directive, you could bind a callback with data-wp-watch that sets the inner HTML of the div when it runs: <div data-wp-watch=”callbacks.renderContent”></div> callbacks: { renderContent() { const context = getContext(); const element = getElement(); element.ref.innerHTML = context.randomPost.content.rendered; }, }, Since the callback uses context.randomPost.content.rendered, it should run any time that … Read more

useSelect() plus resolver result is serving cached data incorrectly

Thanks for MVE, @helgatheviking! It was beneficial. When wp.data caches the resolvers, it also considers arguments. Here’s what happens when following the reproduction steps for the bug: Selecting the first product resolves data, creates a cache for getProduct(1), and sets a value for the product state. Selecting second does the same (cache: getProduct(2)) and sets … Read more

How to re-render Gutenberg component when object instance is available

wp_add_inline_script can be used to insert a tiny trigger script that executes after the script specified in script and any instance defined by that script will be available. // When this js executes `Masonry` is sure to be defined wp_add_inline_script( ‘masonry’, ‘if (window.top !== window) doItNow()’); This will end up being executed twice when the … Read more

Problems with the PluginDocumentSettingPanel SlotFill in Gutenberg

It doesn’t work because that is old behaviour and Gutenberg changed a year ago. Where The Confusion Comes From This commit: https://github.com/WordPress/gutenberg/commit/00cb38c3655daffd429ad4acfc57d6ee3b7f2d83 On Apr 20, 2022 code was removed that made it fallback to the plugin icon. Now an icon has to be explicitly passed as a prop or no icon is shown. Why? https://github.com/WordPress/gutenberg/pull/40355 … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedusedueduseduseduedueduedus