Skip to content
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

feat(releases, core): supporting banner display for remote deleted bundles #7371

Merged
merged 5 commits into from
Aug 19, 2024

Conversation

jordanl17
Copy link
Member

@jordanl17 jordanl17 commented Aug 14, 2024

Description

When you have a document form open for a bundle which is deleted by another user, previously a toast would temporarily show to warn you that the version has been deleted. Now a banner will persist on the document until you navigate away- to make it clear that edits are no longer being applied to where you initially selected:
Screenshot 2024-08-16 at 12 04 56

The exact UX, eg icon/copy/tone are not yet confirmed, but are small fast follows to apply.

What to review

  • Updates to UI Component imports instead of sanity/ui in relevant places
    • And also eslint-ignore for areas where finegrained control of style is required
  • Refactored BundleMenu to BundlesMenu to differentiate it from BundleMenuButton (BundlesMenu is a list of Bundles anyway)
  • memoized some components to avoid rerender cycles due to parent rerenders
  • memoized setPerspective as this was changing quite frequently forcing rerenders
  • Removal of useBundleDeletedToast
  • Created a new DeletedBundleBanner to move this warning to a banner

Testing

Updated tests where necessary

Notes for release

N/A

Copy link

vercel bot commented Aug 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2024 0:06am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2024 0:06am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2024 0:06am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2024 0:06am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2024 0:06am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Aug 19, 2024 0:06am

Copy link
Contributor

No changes to documentation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the logic here is a copy from the existing DocumentDeletedBanner and useBundleDeletedToast. However now there is a single entry point - DocumentDeletedBanners (there are 2 banners that might display for a deleted document - bundle deleted, and non-bundle deleted).

A check if done to see if the bundle has been deleted, and then the relevant Banner component is rendered

)

useEffect(() => {
if (currentGlobalBundleSlug !== LATEST.slug) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkedout bundle slug is the version. Latest ie. draft slug, is not considered checkedout, since it's the default and fallback, so the state value never reflects drafts. This allows for support in cases where usePerspective returns drafts quicker than deletedBundles updates, and in this case the remote deleted bundle would never be tracked and the banner would never be displayed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, I think that adding a similar comment on the code itself would do us good for the future so we can keep this context :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Comment on the esoteric logic in DeletedDocumentBanners

Copy link
Contributor

github-actions bot commented Aug 14, 2024

Component Testing Report Updated Aug 19, 2024 12:13 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 47s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 32s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 38s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 19s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 11s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 48s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 56s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 19s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 28s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 19s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 19s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 57s 30 0 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 21s 3 0 0

@jordanl17 jordanl17 force-pushed the corel-37-deleted-banner branch from c0a4232 to 2ccf035 Compare August 15, 2024 14:13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic and render moved to DeletedDocumentBanners.DeletedDocumentBanner

Copy link
Contributor

@RitaDias RitaDias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 great job!

@jordanl17 jordanl17 merged commit ba7e3fa into corel Aug 19, 2024
42 checks passed
@jordanl17 jordanl17 deleted the corel-37-deleted-banner branch August 19, 2024 14:58
bjoerge pushed a commit that referenced this pull request Aug 20, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
bjoerge pushed a commit that referenced this pull request Aug 20, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
bjoerge pushed a commit that referenced this pull request Aug 20, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
RitaDias pushed a commit that referenced this pull request Aug 23, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
RitaDias pushed a commit that referenced this pull request Aug 26, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
juice49 pushed a commit that referenced this pull request Sep 3, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
RitaDias pushed a commit that referenced this pull request Oct 3, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
juice49 pushed a commit that referenced this pull request Oct 4, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
juice49 pushed a commit that referenced this pull request Oct 7, 2024
…ndles (#7371)

* feat(releases, core): remote deleted version documents will show as banner instead of toast warning

* chore(releases, core): using UI components where available and supported

* chore(core, releases): removing padding and using ui-component buttons

* tests(structure): adding tests for new deleted document banner consolidation

* chore(structure): fixing test imports and mocks
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.

4 participants