WordPress / gutenberg-examples

Examples for extending WordPress/Gutenberg with blocks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make "10-dynamic-block" more dynamic

salcode opened this issue · comments

While 10-dynamic-block does use a dynamic block currently, it behaves in the same manner as a non-dynamic block.

It would be helpful to see the value provided by a block being dynamic (e.g. output a value that could be modified after the post was published).

Just to clarify, the current example doesn't behave in the same manner as a static block as its markup is never saved to the database. However, I completely understand what you're intending with this issue :)

I like the idea of adding a more fleshed-out example that demonstrates the benefits of a dynamic block:

  1. Being able to update the markup that is displayed without needing to add a deprecation and re-saving all instances of the block to see the updates.
  2. Querying the database for information that should not be saved as part of the block - such as latest tags, etc

From an examples point of view, the second point is much easier to demonstrate with working code as it doesn't require the same block with multiple sets of markup.