Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structure field performance #4554

Open
mynameisfreedom opened this issue Aug 8, 2022 · 6 comments
Open

Structure field performance #4554

mynameisfreedom opened this issue Aug 8, 2022 · 6 comments
Labels
needs: delay ⏳️ Requires more time, on hold type: enhancement ✨ Suggests an enhancement; improves Kirby type: refactoring ♻️ Is about bad code; cleans up code

Comments

@mynameisfreedom
Copy link

Hi, structure field is great field, and very usable for many situations, but it is by far the slowest field. If there are several structure fileds in the panel page, it becomes very slow. It loads very slow, and it saves changes even slower.

It is easy to reproduce with two approaches:

  • By adding 2-3 structure fields on one page and adding 3-4 items in them
  • By creating one block with one structure field, adding that block to page and adding several items in block structure field

It works slow in every Kirby 3+ version.
If there is any option to improve performance of that field it will be super welcomed.

@afbora
Copy link
Member

afbora commented Aug 8, 2022

Could you share your blueprint file please?

@afbora afbora added needs: information ❓ Requires more information to proceed needs: replication 🔬 Requires a sample to reproduce the issue labels Aug 8, 2022
@mynameisfreedom
Copy link
Author

Hi, @afbora, can't do it today, but I will as soon as possible. Thank you!

@mynameisfreedom
Copy link
Author

Hi, sorry for the delay, here is a blueprint for testing.
It is a block blueprint, just add it as a new block in your blocks. It is a simplified slider block, where the structure field has options for one image, a blocks field for content, and a few options fields.


name: Slideshow
icon: layers

tabs:
  # content tab
  content:
    label: 
      en: Content
      de: Inhalt
    icon: edit
    fields:
      # slideshow
      slideshow:
        label: 
          en: Slideshow items
          de: Slideshow-Elemente
        type: structure
        columns: 
          slideImage: 
            width: 2/3
          slideContentPosition:
            width: 1/3
        max: 5
        help: 
          en: Maximum 5 items allowed.
          de: Maximal 5 Artikel erlaubt.
        fields:
          # slide image
          slideImage:
            label: 
              en: Slide image
              de: Slide Bild
            type: files
            query: site.images.add(page.images)
            layout: cards
            size: small
            multiple: false
            width: 1/2
            image:
              cover: true
          # kirbytext
          slideContent:
            label: 
              en: Slide content
              de: Slide Inhalt
            type: blocks
            width: 1/2
          # content position
          slideContentPosition:
            label: 
              en: Slide content position
              de: Position des Inhalts verschieben
            type: select
            default: " uk-position-bottom-left"
            options:
              " uk-position-top-left": Top left
              " uk-position-bottom-left": Bottom left
              " uk-position-top": Top
              " uk-position-left": Left
              center: Center
            width: 1/2
          slideContentPositionCenter:
            label: 
              en: Slide content position center
              de: Schieben Sie die Inhaltsposition in die Mitte
            type: select
            default: " uk-position-center"
            options:
              " uk-position-top-center": Top center
              " uk-position-center-left": Center left
              " uk-position-bottom-center": Bottom center
              " uk-position-center": Center
            width: 1/2
            when:
              slideContentPosition: center
          slideContentWidth:
            label: 
              en: Slide content width
              de: Breite des Folieninhalts
            type: select
            placeholder: Auto
            options:
              " uk-width-1-3@s": 1/3
              " uk-width-1-2@s": 1/2
              " uk-width-2-3@s": 2/3
            width: 1/2

HOW TO TEST:

  • Add it to the page, and populate its structure field with several items. Add one image and some simple content blocks.
  • Then duplicate that block a few times, to have 3-4 duplicated blocks on a page
    You will see that page saving and page loading will slow down significantly.

NOTE
I think that the blocks field inside structure field is making the biggest slowdown. A structure field in a block that have Kirby markdown instead of blocks field is a lot faster. It slows down too, but not that much.

@afbora
Copy link
Member

afbora commented Sep 7, 2022

I checked. Yes, we are experiencing the same problem in our own themes (especially in nested blocks).

There's a ticket/issue for this that we're tracking in the backlog. In fact, even PR (#3623) work was done on this issue. It has not merged, but we are aware of the problem. I can't say for sure when it will be resolved. It requires many parts to be refactored.

@afbora afbora added type: enhancement ✨ Suggests an enhancement; improves Kirby type: refactoring ♻️ Is about bad code; cleans up code and removed needs: information ❓ Requires more information to proceed needs: replication 🔬 Requires a sample to reproduce the issue labels Sep 7, 2022
@mynameisfreedom
Copy link
Author

That's good news. The solution starts when we are all aware of the problem. Thank you!

@andreasnymark
Copy link

(Adding to this issue per @afbora request)

Better loading feedback
Panel users are sometimes left in an unknown state, not aware the panel is currently working in the background. This happens when user adds a new item, saves an edit or paginates between items.

Expected behavior
Visual feedback in relation to where the user is working. Disable fields and show a spinner? Dim fields and show a spinner on top? Spinner on button/pagination?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: delay ⏳️ Requires more time, on hold type: enhancement ✨ Suggests an enhancement; improves Kirby type: refactoring ♻️ Is about bad code; cleans up code
Projects
None yet
Development

No branches or pull requests

4 participants