Repository navigation
feat(preview): Update the comparison banner on a live preview - #4907
Conversation
A host can change comparisonBanner after the preview has loaded, for example once the compared version's actions are known. Push the new value to Box Content Preview instead of reloading.
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Walkthrough
ChangesComparison banner synchronization
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
Merge Queue Status
This pull request spent 11 minutes 4 seconds in the queue, including 10 minutes 12 seconds running CI. Required conditions to merge
|
Summary
comparisonBannerinto an already-shown Box Content Preview instead of requiring a reload.ContentPreviewsetspreview.options.comparisonBannerand callspreview.updateComparisonBanner(). It does nothing when the preview is about to reload anyway, or when Box Content Preview has noupdateComparisonBanner.comparisonBanneralready reaches Box Content Preview at first load, because unknown props are spread into the preview options. A host that learns the banner's contents later (for example, which version actions apply once it has fetched the compared version's permissions) had no way to update it.comparisonBannerprop type.preview-client uses this to give the Make Current, Download, and Delete handlers to non-markdown comparison panes (PDF, HTML) without depending on the versions sidebar being open.
Test plan
comparisonBannerafter load and confirm the banner menu updates without the preview reloading.comparisonBannerand confirm the banner menu items go away.comparisonBannerbehaves as before.yarn test src/elements/content-preview/__tests__/ContentPreview.test.jsSummary by CodeRabbit
New Features
Tests