latitude-dev / latitude

Developer-first embedded analytics
https://latitude.so
GNU Lesser General Public License v3.0
673 stars 26 forks source link

Browser cache is not handled correctly #381

Closed csansoon closed 3 weeks ago

csansoon commented 3 weeks ago

Description

When configuring the TTL in a source or a query, responses will contain a 'Cache-Control' header with this ttl option. In most browsers, this will make it cache the response and not actually send the request to Latitude's server until it has expired.

Main issue

Let's say we have a query with a ttl of 1 day. Requesting this query will return its content and cache the response. If the contents of this query change during the day, requesting the query from the same browser again will not show the updated data, this is expected behaviour. To update it, the user sends a request with the "__force" parameter. This results in two issues:

Goal of Feature

  1. Do NOT cache forced requests.
  2. Manage the browser's cache invalidation

Current Solution / Workarounds

The only way to bypass this issue is by disabling browser cache.

geclos commented 3 weeks ago

solved in #383