Message doesn't show or clear at scheduled times

Created on 14 March 2023, almost 2 years ago
Updated 20 November 2023, about 1 year ago

Problem/Motivation

This seems to be a caching issue and is inconsistent. I've had instances where the message doesn't display when the start time is reached, but more often it doesn't clear after the end time occurs. It also seems to depend on where you place the block, it works better when placed with Layout Builder, but not when it's placed in another theme region. Debugging the code, the cache seems to always be set to -1, which is permanent. Not sure how this could ever work with multiple messages starting and ending at various times.

Steps to reproduce

Create/edit a message, setting the publish date/time a few minutes ahead of current time, and unpublish date/time a few minutes after that. Place the Notifications Message block in both a Layout Builder page, and another theme region. Refresh the page at the start time, if it doesn't appear, clear caches and it will. Same when the end time is reached. The LB instance may work, but not the other.

Proposed resolution

Add a getCacheMaxAge() function to set 0 seconds for non caching.

Remaining tasks

Creating a fork here with the code change.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States JCL324 Portland, OR

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

Comments & Activities

Production build 0.71.5 2024