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

fix(presentation): prevent openInStructure from linking to the presentation tool itself #1762

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

marcusforsberg
Copy link
Contributor

Hey Sanity team! 👋

On some of our projects, the Presentation tool is the only tool used to work with content; i.e. there's no Structure tool at all.
In this scenario, the "Open in Structure" action will end up linking back to the Presentation tool itself, so nothing happens when you click on it.

Example screenshot below. Our Presentation tool is titled "Live Edit" and the action says "Open in Live Edit", but that tool is already open so the button effectively does nothing.

Screenshot 2024-08-27 at 15 38 52

This PR solves that by excluding the Presentation tool when trying to find matches in findStructureTool. With this change, there's no action button shown at all, since there's no relevant tool to link to:

Screenshot 2024-08-27 at 15 42 48

@marcusforsberg marcusforsberg requested a review from a team as a code owner August 27, 2024 13:51
Copy link

vercel bot commented Aug 27, 2024

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

Name Status Preview Comments Updated (UTC)
live-visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-astro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-next-with-i18n ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-nuxt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-page-builder-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-remix ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm
visual-editing-svelte ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:26pm

Copy link

vercel bot commented Aug 27, 2024

@marcusforsberg is attempting to deploy a commit to the Sanity Sandbox Team on Vercel.

A member of the Team first needs to authorize it.

@marcusforsberg marcusforsberg changed the title fix(presentation): prevent openInStructure from from linking to the presentation tool itself fix(presentation): prevent openInStructure from linking to the presentation tool itself Aug 27, 2024
stipsan
stipsan previously approved these changes Jan 9, 2025
Copy link
Member

@stipsan stipsan left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! 💖

…resentation tool itself
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants