- Issue created by @iheb.attia
- Merge request !14#3531812: Deleting custom tokens does not invalidate token cache → (Merged) created by Unnamed author
- Status changed to Needs work
10 days ago 5:04pm 29 September 2025
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.
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.
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.
Active
1.0
Code