Skip to content

[Frontend] Implement caching for data on frontend #143

@eclipse-909

Description

@eclipse-909

Description

It's expensive to make network requests to fetch data every time. We should take advantage of the browser cache to store messages, events, itineraries, and all relevant data to minimize network requests.

Acceptance Criteria

  • Api-calling functions look for data in the browser cache
  • Cache hit results in immediately returning the data and not making the network request
  • Cache miss results in the network request being made, and the cache is updated with the result
  • Cache is used for functions where the user directly controls the data
  • Cache is not used for functions where the data is updated behind the scenes without the user
  • Functions that mutate/delete data in the db will do the same mutations/deletions for that data in the cache to keep the cache up to date

Developer Notes

  • Don't use local/session storage. Use the actual browser cache.

Data that should be cached:

  • Non-sensitive account info
  • The user's itineraries (saved itineraries and unsaved AI-generated itineraries)
  • Events - it's possible events get updated behind the scenes, so maybe we can give events an expiration date in the cache to force it to update them once in a while
  • Messages
  • Chat sessions

Data that should NOT be cached:

  • Public itineraries - you can't know when it's been updated in the db

Metadata

Metadata

Assignees

No one assigned

    Labels

    storyThis issue is a story which is part of an epic

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions