Local Storage for Coffee

Created on 17 March 2015, almost 10 years ago
Updated 13 January 2024, 11 months ago

Problem/Motivation

Noticed a todo in the code to use local storage, decided to give it a shot.

Proposed resolution

Use session storage so we don't have to worry too much about invalidation.

Remaining tasks

User interface changes

API changes

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡·Argentina hanoii πŸ‡¦πŸ‡·UTC-3
  • πŸ‡¦πŸ‡·Argentina hanoii πŸ‡¦πŸ‡·UTC-3

    6 years after the last comment I needed this feature, as I wanted to offload this request to a multisite on with not a huge amount of resources.

    Overall I feel it's quite good, I added an install hook, a configuration option and small theme tweaks so that you can see if the data is cached as well as an option to refresh it. See MR !8

  • πŸ‡ΊπŸ‡ΈUnited States fizcs3 Omaha, Nebraska; USA

    We've had the patch from MR8 running for some time and is seeming good, currently applying to Drupal 10.2.7 with Coffee 8.x-1.4.
    Help to performance so that the system is not unnecessarily scouring the site for all admin link options every time.
    Thank you @hanoii

  • Status changed to Needs work about 1 month ago
  • πŸ‡«πŸ‡·France dqd London | N.Y.C | Paris | Hamburg | Berlin

    Bump this to Major regarding the improvement stated in #17 πŸ“Œ Local Storage for Coffee Needs review "Help to performance so that the system is not unnecessarily scouring the site for all admin link options every time."

    Maybe needs a reroll or new branch to sync MR with πŸ“Œ Automated Drupal 11 compatibility fixes for coffee RTBC for possible upcoming Coffee Drupal 11 release.

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

    Just (re-)discovered this in πŸ“Œ Add performance testing Active .

    Given that Coffee is activated by a link or keyboard shortcut, could the AJAX request not be deferred to then? If it's in local storage it should be instant, but it would help in the non-cached case and potentially also help with browser memory usage given the data structure wouldn't be loaded on most requests then.

    On the approach here, I think it would make sense to key the local storage key by Drupal core version and/or $settings['deployment_identifier'] or possibly something added to Drupal settings that is based on a hash of the menus being fetched - could be written to state on menu link rebuild or similar. That would allow for a longer TTL then, or possibly even hard-coding the TTL if it's reliable enough. Core's toolbar module has similar logic to do a similar-ish thing.

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

    Postponing this on πŸ“Œ Implement caching mechanism Active and πŸ“Œ Get coffee data only when the search box is opened Active - those can be done without complex complex cache invalidation logic (or cache staleness bugs), and should make this less necessary. If it's still necessary after those, then dynamic_page_cache support would allow for a short TTL here without much impact on server load.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
Production build 0.71.5 2024