Skip to content

Upgrade clover to v4.4.2 - #516

Closed
kdid wants to merge 1 commit into
deploy/stagingfrom
clover-4
Closed

kdid wants to merge 1 commit into
deploy/stagingfrom
clover-4

Conversation

@kdid

@kdid kdid commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Upgrades Digital Collections from the deprecated @samvera/clover-iiif 3.17.0 to @nulib/clover 4.4.2 (now maintained in nulib-ds/clover) for the work-page viewer, the IIIF primitives (title, summary, metadata, thumbnails) and the collection/related-item sliders.

Clover 4 is a rewrite, not a drop-in upgrade: settings are props instead of an options object, the markup and class names are new, and the package is ESM-only. This PR moves DC onto it while keeping the current look and behavior. Users get Clover 4's viewer, with highlighted content-search hits, a transcript view for A/V, and new image controls, while panel tabs, sliders and typography still look like current DC.

User-facing:

  • Viewer: the panel shows Search and Annotations, plus About during a content search, as now. It opens automatically for works with annotations. On audio/video works, the VTT tab is labeled "Chapters".
  • Sliders: same look as now (purple title, pill "View All" button, same column counts per breakpoint). Thumbnails are now consistently square, which also fixes the mixed-size thumbnails currently visible on some prod pages.
  • Transcripts/VTT: load correctly (see the request change below).

Changes

  • Dependency: replaced @samvera/clover-iiif with @nulib/clover 4.4.2. pages/_app.tsx now imports @nulib/clover/styles.css.
  • Viewer (components/Clover/ViewerWrapper.tsx, `components/Work/EmbeddedViewer.tsx):
    • Moved 3.x options to Clover 4 props: header, defaultPanelOpen, panelLayout="tabs", panelSections, panelLabels, request, searchQuery, onContentStateChange. The 640px canvas height is now --clover-body-height.
    • Removed the 3.x MutationObserver that forced the Search tab open. Clover 4 opens Search itself when searchQuery is set.
    • The viewer loads through components/Clover/CloverViewer.tsx, because next/dynamic's require.resolveWeak can't resolve an import-only package.
  • Requests (components/Clover/clover-request.ts, new): Clover 4 applies one request setting to everything it fetches.
    • Credentials still go with JSON requests (manifests, image info.json, search, annotation pages), so restricted works keep working.
    • Text resources (WebVTT under /public/vtt/) are fetched without cross-origin credentials, because that host answers Access-Control-Allow-Origin: *, which browsers reject for credentialed requests. Without this, the transcript tab was blank.
    • A credentialed request that's still rejected is retried once without credentials.
  • Primitives (TopInfo, Metadata, Hero, Homepage/Overview, EmbedResources):
    • Props renamed to Clover 4's value=. Metadata's custom search links moved from customValueContent to renderValue.
    • Hero builds the region-cropped IIIF image URL itself, since Clover 4's Thumbnail has no region prop.
  • Sliders (components/Clover/SliderWrapper.tsx):
    • Now <Items layout="slider">.
    • Keeps DC's credentialed collection fetch, abort handling and error-boundary behavior.
    • The "View all" search URL is passed as the collection's homepage.
    • Nested collections are filtered out, as the 3.x CSS used to hide them.
  • Styles (ViewerWrapper.module.css, SliderWrapper.module.css): rewrote the overrides for Clover 4's markup.
    • Panel text is rescaled to DC's gr3 size. Clover 4 sizes text in rem, and DC's root is 19px, so panel text came out too large.
    • Slider titles, the "View all" pill and the square thumbnails match current DC.
    • The column counts and gaps per breakpoint are unchanged.
  • Jest (jest.config.js): transform @nulib/clover and @iiif/parser, which are ESM-only. Slider and viewer tests were updated for Clover 4, and clover-request.test.ts was added.
  • Data fix (lib/constants/homepage.ts): one homepage overview thumbnail URL contained //full/ and returned 403. Clover 3 built a different URL from the image service and hid the typo.

Testing

npm ci
export NEXT_PUBLIC_DCAPI_ENDPOINT=https://dcapi.rdc-staging.library.northwestern.edu/api/v2 &&  npm run dev 

Known differences / follow-ups

  • Deep links from content-search results open on the first hit instead of the page that was clicked, because Clover 4's Search panel auto-selects the first hit. A fix has been prepared for nulib-ds/clover Center searches around user and start from current canvas. nulib-ds/clover#397, h. Once it's released, bump @nulib/clover.
  • Search text isn't saved in the URL: typing in the viewer's Search no longer updates ?content-search=. Clover 4 has no contentSearchCallback; there's a TODO in ViewerWrapper.tsx. Searches started from the URL still work.
  • Homepage overview video thumbnail (HLS .m3u8) didn't play, because Clover 4's Thumbnail only renders <img>. The video tile is now a still poster frame.

@kdid kdid self-assigned this Nov 5, 2026
@kdid
kdid force-pushed the clover-4 branch 3 times, most recently from 94adbf4 to f90ef4a Compare November 5, 2026 20:52
@kdid
kdid marked this pull request as ready for review November 5, 2026 21:06
@kdid
kdid requested review from bmquinn and mathewjordan November 5, 2026 21:06
@kdid kdid closed this Nov 5, 2026
@kdid
kdid deleted the clover-4 branch November 5, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant