Asynchronous files access for blueprint extension


inside my Builder Field userts have the possibility to predefine various fieldsets in a blueprint that can then be combined as builder blocks in the panel. Since such blueprint configurations can become very complex, especially when the builder is nested, it makes sense to split them into different files using extends. Accessing all those different files seems to be a real performance bottleneck when the builder setup is rather complex and has a lot of nested extends.

Does Kirby use some kind of asynchronous file handling under the hood that could be adapted by me to solve this issue?

My current approach was to outsource the asynchronicity to the frontend and split it into several requests to the backend. However, this is also not a perfect solution for a number of reasons.

How many blocks are we talking about here? I have quite a complex setup with the builder using extends, and have not noticed any slowdown. I did it like this…

type:             group
    label:        Page Blocks
    type:         builder
    columns:      1
    max:          99

      # CTA
        label:    CTA
        extends:  blocks/cta

      # Gallery
        label:    Gallery
        extends:  blocks/gallery

      # Text
        label:    Text
        extends:  blocks/text

      # Video
        label:    Video
        extends:  blocks/video

      # Tweets
        label:    Tweets
        extends:  blocks/tweets

And for example, the gallery block looks like this…

type:                 group
    label:            Content
        label:        Gallery
        type:         files
        layout:       cards
        query:        page.images
        uploads:      images
        size:         tiny
          cover:      true
          ratio:      16/9

    label:            Settings
        label:        Show Title
        type:         toggle
        width:        1/2
        label:        Show Caption
        type:         toggle
        width:        1/2

In my example, there are 15 block types, all of them have around four tabs where each of them is an extended configuration for itself. So i end up with approximately 15 * 4 = 60 extend calls. In addition to that, some blocks have nested builders that could again contain the same set of blocks. So, in my scenario I would end up with 200 extend which leads to a 8 second delay until the panel is available.

Most of the tabs extend the same file. I thought about at least chaching those duplicate extend calls. I didn’t get this to work by now.