Optimize AI Automator Token Browser Performance for Sites with Numerous Fields

Created on 2 December 2024, 19 days ago

Problem/Motivation

On larger sites with many fields, the AI Automator configuration’s token browser currently loads fully during each page load. This behavior causes significant delays, often freezing the browser for several seconds or even up to a minute on slower CPUs. These delays hinder efficient tweaking and configuration adjustments.

Steps to reproduce

1. Navigate to a content type on a larger site with many fields.
2. Edit a field where AI Automator is enabled.
3. Observe the token browser loading time during the page load.

Proposed resolution

Replace the current integrated token browser, which preloads during the page load, with a modal-based token browser. This modal would only appear when triggered via a clickable link, significantly improving performance and user experience.

✨ Feature request
Status

Active

Version

1.0

Component

AI Automators

Created by

πŸ‡¦πŸ‡ΉAustria roromedia Linz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @roromedia
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    The token browser isn't part of this module, so isn't ours to do anything about. Other modules have been developed that mitigate this issue for larger sites so if you are having this issue you may wish to investigate them, or raise it as an issue with the Token module's team (although I suspect it has been raised before so search their issue queue first).

  • πŸ‡¦πŸ‡ΉAustria roromedia Linz

    HI, it is not an issue with the token browser that it gets slow - it is more the way it is integrated in the form here. It would be better to just make a link instead load it fully.

  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Like I say, that's how the Core token module is generating it: this isn't our code to change or an issue we can resolve.

  • πŸ‡¦πŸ‡ΉAustria roromedia Linz

    I think there is a misunderstanding, what I try to point out is that it should be done differently (as webform is doing it), like here the "Browse available token" link - if webform would always load the full token browser on every AJAX settings panel for each field it would be unusable: https://pasteboard.co/dkCzHcfW9z8c.png

  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    You are right and I am wrong: the automator isn';t using core's recommended method for rendering the token help but is directly rendering a Token module's token tree on the page.

  • πŸ‡¦πŸ‡ΉAustria roromedia Linz

    Thank you for investigating that issue further - that makes sense why it slows down at this point. Let's keep this issue open until it is resolved. It isn't critical as it doesn't break functionality it is just annoyingly slow currently for quick edits.

  • Pipeline finished with Failed
    16 days ago
    Total: 170s
    #361114
  • Pipeline finished with Success
    16 days ago
    Total: 220s
    #361118
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith
  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Thank your for cleaning up the code Paul and for fixing this. Code wise it looks good, Roland could you test the actual functionality changes before we merge?

  • πŸ‡¦πŸ‡ΉAustria roromedia Linz

    Hi Marcus, I patched the ai module and can confirm that it works - now I am getting a "Browse available tokens" link and the token modal - beautiful, much faster to do tweaks regardless of the field count in the installation.

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Then we merge, thank you both!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024