-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
History does not work for classes extending SiteTree #2606
Comments
@unclecheese This is a tricky one. One the one hand, queries like Option A: Refactor to |
I would note that using pages that don't extend Page is an edge-case behaviour and so I'd design the API to treat it as such. That would probably push us toward Option C. A couple of downsides:
Given the above Option B might be easier... how much slower are we talking? |
Trivially slower. I think, very generally speaking, test show that 50 dataobjects with relationships and versioning, fully loaded, every feature enabled, no caching, is about 7 seconds of generation. One little page class with read only exposed is easily less than 300ms. Wondering, is this just a case of better documenting how important Page is to the CMS, and that breaking this convention has consequences? In SS4, I can't see why you would ever want to do this short of a lack of understanding. |
@mikenz What was your rationale for skipping the |
@chillu We do this too, mainly because when originally starting out with SS4 I wanted to ensure as much as possible was PSR-4 compliant. The un-namespaced Page doesn’t really fit into that very nicely, so at the time I opted to work around it like this: https://github.com/bigfork/silverstripe-recipe/blob/master/app/src/bootstrap.php, loaded with composer.json So adding an example class of
I remember wondering at the time if it might come back to bite me 😉 |
We've had a related discussion back in 2016 about namespacing Page. The accepted solution there was the same as Loz' example from above. @silverstripe/core-team I'm recommending that we document the requirement to use |
Should Page and SiteTree merge back together from SS5? |
I was wrong in my comment in that thread - the accepted solution there doesn’t work. |
History makes the assumption that all pages on the site are classes that extend Page (https://github.com/silverstripe/silverstripe-cms/blob/4/client/src/state/history/readOnePageQuery.js#L10).
This is an incorrect assumption and when attempting viewing the history of an item that extends SiteTree, but not Page, the user just receives a spinning SS. Any class that extends SiteTree is a valid page, and history should work correctly for these.
Unfortunately this impacts over 50% of our pages.
The text was updated successfully, but these errors were encountered: