Open traut opened 3 months ago
with #142 bringing the blocks that have conditions in them, it makes sense that the dependent block is not included if any of the dependencies is not included (condition_query
result is false)
I moved to draft
to re-think this issue. There might be a way to implement it through the conditions in the dynamic block
Background
With https://github.com/blackstork-io/fabric/issues/17 implemented, it will be possible to query the template tree in the content blocks. Extending this approach, the block should be able to query the already processed blocks.
This issue covers the dependencies of content blocks. The dependencies allow us to support the introspective logic in the plugins, which processes already rendered content.
It will also be valuable to have the dependencies for the data blocks. Still, since the data blocks do not support the
query
attribute and the context processing, implementing the dependency hook requires a separate issue.Design
By default, the content blocks do not depend on the execution of the other content blocks, making it possible to run them concurrently. An exception to that is the blocks that explicitly depend on the results of the execution of the other blocks.
To make the content block depend on the execution of the other blocks new attributes are introduced:
depends_on
-- (optional) a list attribute that accepts a list of block signatures (see below on the exact format)depends_on_above
-- (optional) a bool attributeThe content blocks can depend on the evaluation of
Behaviour:
depends_on
attribute, it is evaluated after all the dependencies are evaluateddepends_on_above
attribute, it is evaluated after all the content / section blocks above it are evaluated.output
top-level field. The individual results are accessible using the pathoutput.content.<content-provider>.<name>
In the case of circular dependency (the block depends on itself or its parent block), the error should be raised.
will produce
References