Skip to content

Commit

Permalink
fix X-Reload not doing anything
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed May 3, 2024
1 parent c0cb48d commit 130c0f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ActionsGridFieldItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,13 @@ protected function forwardActionToRecord($action, $data = [], $form = null)

if (Director::is_ajax()) {
$controller->getResponse()->addHeader('X-Status', rawurlencode($message));

//@phpstan-ignore-next-line
if (method_exists($clickedAction, 'getShouldRefresh') && $clickedAction->getShouldRefresh()) {
$controller->getResponse()->addHeader('X-Reload', "true");
// Requires a ControllerURL as well, see https://github.com/silverstripe/silverstripe-admin/blob/a3aa41cea4c4df82050eef65ad5efcfae7bfde69/client/src/legacy/LeftAndMain.js#L773-L780
$url = $controller->getReferer();
$controller->getResponse()->addHeader('X-ControllerURL', $url);
}
// 4xx status makes a red box
if ($error) {
Expand Down

0 comments on commit 130c0f0

Please sign in to comment.