Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Layout can shift as data is fetched from a menu endpoint. We should consider indicating some kind of loading state as data is fetched or otherwise address the flash of menu content following the API response.
Proposed resolution
* Add a loading state when fetching menu data.
* This loading state will not be used when menu tree data is provided directly.
* Consider making the use of a loading state configurable based on an attribute.
Remaining tasks
* Implement loading state.
Issue fork gdwc-3207892
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
brianperryComment #3
brianperryComment #4
joegraduateTaking a look at this.
Comment #6
joegraduateComment #7
brianperry@joegraduate Looking good - I was even able to test it using the tugboat preview :)
Just added a few comments on the MR - the biggest thing being making it possible to override the loading message.
Comment #8
joegraduate@brianperry, I've updated the MR with the changes you suggested. I wonder if we might actually be able to provide this functionality without the isLoading property if we were to use the until directive of lit-html.
Comment #9
joegraduateComment #10
brianperry@joegraduate I wasn't aware of lit-html's `until` but that looks like it is tailor made for this case. I think it would be worth updating to use that if you're willing.
Comment #11
joegraduateI took a crack at using the lit-html until directive but was unable to get anything working so far. We discussed this briefly in the 2021-04-15 Decoupled Menus contib event and @brianperry suggested that we could tackle that in a separate issue. At this point I think this issue is ready for review.
Comment #13
brianperryMerged. Thanks @joegraduate
Comment #14
joegraduateFollow-up task: #3209033: Replace loading state with lit-html until directive
Comment #15
brianperry