Module version(s) affected
3.1.1
Description
Click to see original problem
See related issue. The docs note that staging can be disabled to track changes without a draft stage, but this module doesn't seem to support that use case, and trying to use a HistoryViewerField results in an empty table as the request for records errors out.
If I change this line to return true, the request to get records works fine and other versions are displayed, but they all have a LIVE label, and the UX breaks once you try to open a record for comparison.
How to reproduce
<?php
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned;
use SilverStripe\VersionedAdmin\Forms\HistoryViewerField;
class ThingWithChangeHistory extends DataObject
{
private static $db = [
'Title' => 'Text',
];
private static $extensions = [
Versioned::class . '.versioned',
];
public function getCMSFields(): FieldList
{
$fields = parent::getCMSFields();
$fields->addFieldToTab(
'Root.History',
HistoryViewerField::create('HistoryViewer')
);
return $fields;
}
}
if I select a record, the request for (I assume) the diff gives a 500 error and no content is visible:
Likewise if I try to compare:
The same error is triggered in both cases, but via /admin/historyviewer/schema/compareForm/ in the latter case:
ERROR [Emergency]: Uncaught Error: Call to a member function remove() on null
IN GET /admin/historyviewer/schema/versionForm//3432?RecordVersion=6&RecordClass=[REDACTED]&RecordID=3432
Line 117 in /[REDACTED]/vendor/silverstripe/versioned-admin/src/Forms/DataObjectVersionFormFactory.php
Source
======
108:
109: /**
110: * Remove all GridField instances from the form as they isn't a corresponding react
111: * field to render the GridField on the frontend.
112: */
113: private function removeGridFields(FieldList $fields)
114: {
115: $fields->recursiveWalk(function (FormField $field) {
116: if ($field instanceof GridField) {
* 117: $field->getContainerFieldList()->remove($field);
118: }
119: });
120: }
121:
122: /**
123: * Do not return {@link HistoryViewerField} instances in the form - remove them if they are
found
Trace
=====
SilverStripe\VersionedAdmin\Forms\DataObjectVersionFormFactory->SilverStripe\VersionedAdmin\Forms\{closure}(SilverStripe\Forms\GridField\GridField)
FieldList.php:73
Possible Solution
No response
Additional Context
No response
Validations
Kitchen sink CI
PRs
Module version(s) affected
3.1.1
Description
Click to see original problem
See related issue. The docs note that staging can be disabled to track changes without a draft stage, but this module doesn't seem to support that use case, and trying to use a HistoryViewerField results in an empty table as the request for records errors out.
If I change this line to return true, the request to get records works fine and other versions are displayed, but they all have a LIVE label, and the UX breaks once you try to open a record for comparison.
How to reproduce
if I select a record, the request for (I assume) the diff gives a 500 error and no content is visible:
Likewise if I try to compare:
The same error is triggered in both cases, but via
/admin/historyviewer/schema/compareForm/in the latter case:Possible Solution
No response
Additional Context
No response
Validations
silverstripe/installer(with any code examples you've provided)Kitchen sink CI
PRs