Cache is not invalidated when recurring date instance passes

Created on 4 February 2022, almost 3 years ago
Updated 11 July 2024, 5 months ago

Problem/Motivation

I have a node with a Smart Date Recur field. The formatter is configured to show the first upcoming recurring date instance. Once that date has passed, I expect it to show the first upcoming date after that. However, the output is cached and the past date instance is shown until I manually rebuild cache.

Steps to reproduce

1. Set up a content type with a recurring date field. My field.field.node.event.field_date_time.yml:

langcode: en
status: true
dependencies:
  config:
    - field.storage.node.field_date_time
    - node.type.event
  module:
    - smart_date
    - smart_date_recur
third_party_settings:
  smart_date_recur:
    allow_recurring: true
    month_limit: 12
id: node.event.field_date_time
field_name: field_date_time
entity_type: node
bundle: event
label: 'Date and time'
description: ''
required: true
translatable: false
default_value:
  -
    default_duration: 60
    default_duration_increments: "30\r\n60|1 hour\r\n90\r\n120|2 hours\r\ncustom"
    default_date_type: ''
    default_date: ''
default_value_callback: ''
settings: {  }
field_type: smartdate

2. Configure the formatter to show the first upcoming date. Field formatter settings taken from my core.entity_view_display.node.event.full.yml:

  field_date_time:
    type: smartdate_recurring
    label: hidden
    settings:
      timezone_override: ''
      format_type: medium
      format: default
      force_chronological: true
      add_classes: false
      time_wrapper: true
      past_display: 0
      upcoming_display: 1
      show_next: true
      current_upcoming: '1'
    third_party_settings: {  }
    weight: 1
    region: content

3. Wait for the first upcoming date to pass and see how the cached output remains the same.

Proposed resolution

Discuss! Maybe we can set a cache max age equal to the time until the next recurring date instance?

Remaining tasks

Fix, test.

User interface changes

none

API changes

none

Data model changes

none

πŸ› Bug report
Status

Fixed

Version

3.5

Component

Smart Date Recur

Created by

πŸ‡³πŸ‡±Netherlands marcvangend Amsterdam

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

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States sclsweb

    Apologies for resurrecting a closed issue, but is there a recommended technique for ensuring that anonymous visitors don't see past dates on nodes with the Recurring smart_date formatter displaying upcoming events? I respect that the issue will have to be fixed in core, but I despair of that ever happening. What is the current state of the art for solving this? Any low- or no-code workarounds?

Production build 0.71.5 2024