Accidentally building mirrors🪞


In the context of Athens, each block is the base unit of data, and all the uniqueness for it comes from block-uid. The problem statement here was to have the same block replicated elsewhere(mirrored) on the same page or on a different page while retaining all the functionality of the block(todo's, embeds, iframes etc) i.e block should behave exactly the same way. Workflowy explains the idea better.


The solution was twofold. The first was to separate out the behavior and definition of components themselves without being tied to any of the existing deps. The reason being, that extending the component framework is quite important for the app as more in-built functionality/core items will come from components instead of plug-ins(which are extensions to non-core items).
Once that is done, all that was left to achieve ephemeral block uniqueness across the app. The solution itself was simple. It involved adding a unique temp id to the block in a specific way and writing out helpers such that the functionality that depends on block-uid to work can extract out and use it or/and temp-id.
PR here and it has demos for each stage of how it evolved. Thanks to Jeff for finding all the nitty edge cases and his help in finishing up the patch.


The most ideal scenario would be to add unique ids to all blocks and all the functionality understands it and uses it depending on the use case.


Last modified 4mo ago
Copy link