Add History route (#30)#120
Draft
mliebischer wants to merge 13 commits into
Draft
Conversation
Extract the route's inline list into a prop-driven HistoryView component styled like the @@contents view (Quanta table, breadcrumb with home icon, status dots, relative timestamps). Replace the immediate revert submit with a confirmation dialog and style the revert menu action as destructive (red). Keep the dialog text stable during the close animation, and hide the History toolbar button on the Plone Site root, which has no history, matching Volto's behavior.
Cover the view with vitest unit tests (status dot and relative-time helpers, rendering, revert confirmation flow, axe accessibility check) and Playwright acceptance tests (listing, revert with confirmation, History toolbar button hidden on the site root). The axe check surfaced an empty actions column header, now labelled via VisuallyHidden text.
Two bugs hid each other: the content middleware never read the ?version query parameter, and getContent dropped the expand parameter whenever a version was requested. The middleware now passes the version through (including the anonymous retry), and getContent applies expand to the @history endpoint as well. Covered by client integration tests, a middleware test, and acceptance tests including that anonymous visitors cannot access old revisions.
Number(formData.get('version')) turned a missing field into 0 and
garbage into NaN, both passed unchecked to revertHistory, and a failing
backend call threw into the error boundary. The action now rejects
invalid versions with a 400 data response and reports backend failures
as a 502 data response so the UI can react.
The dialog used to close right after submitting, so a failing revert went unnoticed. It now stays open while the request is in flight with the confirm button disabled, closes itself only on success, and shows an inline error message otherwise (new locale strings in en/de/it). The acceptance test now also asserts that the restored title is shown after a successful revert.
An unparsable entry date crashed the whole route with a RangeError from the date formatter; the raw value is now shown instead and each entry date is parsed only once. Rows use stable entry-based keys instead of array indexes, so identities survive loader revalidations after a revert. Intl.RelativeTimeFormat instances are cached per locale instead of being constructed per row.
Use t('cmsui.history.label') instead of a hardcoded aria-label.
Cover the anonymous login redirect, back-button navigation, empty histories, the absolute-date tooltip, and the revert action's input validation and error responses.
Workflow rows now read like Volto: 'Publish (Private → Published)', using the backend-translated state titles. Unlike Volto, no literal 'undefined' is shown when no previous state is known (e.g. creation); those entries read 'Create (Private)'. This is an interim display until the final action-label wording from the design is decided.
This was referenced Jun 11, 2026
04e5654 to
cd2f0aa
Compare
# Conflicts: # packages/cmsui/locales/de/common.json # packages/cmsui/locales/en/common.json # packages/cmsui/locales/it/common.json # packages/publicui/routes/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the CMSUI History route (
/@@history/<path>)Current state, open points, and follow-up issues are tracked in one place: #30 (comment).
Closes #30