Bug #88939

Custom CacheAction cannot send success state and custom flash messages

Added by Guido Schmechel 9 days ago. Updated 8 days ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Backend JavaScript
Target version:
-
Start date:
2019-08-08
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Content:
Add a cacheAction via $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions']. Everything is fine and the cache icon is displayed in the topbar. Sending a JsonResponse via interface:

    /**
     * @param ServerRequestInterface $request
     * @return ResponseInterface
     */
    public function flush(ServerRequestInterface $request): ResponseInterface
    {
        return new JsonResponse(['success' => true]);
    }

We get a red FlashMessage with the hardcoded "An error occurred while clearing the cache. It is likely not all caches were cleared as expected." text.

The message is thrown from https://github.com/TYPO3/TYPO3.CMS/blob/master/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ClearCacheMenu.ts#L72 because we have a response. It does not matter what is inside, as you can see.

Solution:
We need a proper solution for this typescript case. Luckily we have a similar solution here: https://github.com/TYPO3/TYPO3.CMS/blob/master/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ClearCache.ts#L67

History

#1 Updated by Gerrit Code Review 8 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61481

Also available in: Atom PDF