Deleting custom tokens does not invalidate token cache

Created on 23 June 2025, 4 months ago

Problem/Motivation

After deleting a custom token, it still appears when retrieving the list of available tokens. This happens because the token cache is not invalidated upon deletion, unlike when a token is created or updated. As a result, stale tokens remain accessible until the cache is manually cleared or expires, which can cause confusion and unintended behavior.

Steps to reproduce

1. Create a custom token using the custom tokens module form.
2. Verify that the token appears in the list of available tokens.
3. Delete the custom token.
4. Retrieve the list of tokens again (e.g., via `hook_token_info()`, `Token Browser` or similar methods).
5. Observe that the deleted token still appears due to the cache not being invalidated.

Proposed resolution

Invalidate or clear the token cache when a custom token is deleted, similar to the cache invalidation behavior performed when creating or updating a token. This will ensure that deleted tokens are immediately removed from any token listings and prevent stale data from persisting.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France iheb.attia

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024