Skip to content

feat(vision): save vision queries#9004

Merged
ChrisLaRocque merged 81 commits intomainfrom
vision_save-queries
May 21, 2025
Merged

feat(vision): save vision queries#9004
ChrisLaRocque merged 81 commits intomainfrom
vision_save-queries

Conversation

@ChrisLaRocque
Copy link
Copy Markdown
Collaborator

@ChrisLaRocque ChrisLaRocque commented Mar 20, 2025

Description

Provides the ability to save and recall previously ran queries by individual users via a secret document.

This change was built in response to customer feedback of wanting a way to recall previously ran queries in Vision.

What to review

  • Normal vision functionality remains intact
  • You can save a query
  • You can browse and load previously ran queries
  • Does the load queries table fit into Studio branding/styling?

Testing

Notes for release

@ChrisLaRocque ChrisLaRocque requested a review from a team as a code owner March 20, 2025 15:46
@ChrisLaRocque ChrisLaRocque requested review from jordanl17 and removed request for a team March 20, 2025 15:46
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 20, 2025

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 May 21, 2025 5:32pm
performance-studio ✅ Ready (Inspect) Visit Preview May 21, 2025 5:32pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2025 5:32pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
e2e-studio ⬜️ Ignored (Inspect) May 21, 2025 5:32pm
studio-workshop ⬜️ Ignored (Inspect) Visit Preview May 21, 2025 5:32pm
test-next-studio ⬜️ Ignored (Inspect) May 21, 2025 5:32pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 20, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.37% 58386 / 134615
🔵 Statements 43.37% 58386 / 134615
🔵 Functions 47.91% 2914 / 6081
🔵 Branches 79.54% 10848 / 13638
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/@sanity/vision/src/components/PerspectivePopover.tsx 0% 0% 0% 0% 1-112
packages/@sanity/vision/src/components/QueryRecall.styled.tsx 0% 0% 0% 0% 1-25
packages/@sanity/vision/src/components/QueryRecall.tsx 0% 0% 0% 0% 1-393
packages/@sanity/vision/src/components/VisionGui.tsx 0% 0% 0% 0% 1-722
packages/@sanity/vision/src/hooks/useSavedQueries.ts 0% 0% 0% 0% 1-139
packages/@sanity/vision/src/i18n/resources.ts 0% 0% 0% 0% 1-132
Generated in workflow #35485 for commit 5d97da0 by the Vitest Coverage Report Action

@pedrobonamin pedrobonamin self-requested a review March 20, 2025 16:01
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 21, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@@ -0,0 +1,28 @@
import {Box, Stack} from '@sanity/ui'
import styled from 'styled-components'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
import styled from 'styled-components'
import {styled} from 'styled-components'

Comment on lines +360 to +378
<Button
mode="bleed"
tone="critical"
width="fill"
onClick={(event) => {
event.stopPropagation()
deleteQuery(q._key)
}}
disabled={deleting.includes(q._key)}
>
<Flex align="center" gap={2} padding={1}>
<Box
style={{fontSize: '1.25em', display: 'flex', alignItems: 'center'}}
>
<TrashIcon />
</Box>
<Text size={1}>{t('action.delete')}</Text>
</Flex>
</Button>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can use here menu item instead, and it takes an action so it will give you the menu looking like the studio for free.
See for example this https://github.com/sanity-io/sanity/blob/main/packages/sanity/src/core/comments/components/list/CommentsListItemContextMenu.tsx#L136-L146

Copy link
Copy Markdown
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

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

This is huge improvement, users will be so pleased with this new functionality! Thank you for building this.

Added some suggestions, let me know if you have any questions on them, happy to help get this through the line.

Great work @ChrisLaRocque appreciate it! Would love to see more contributions like this 😄

Comment thread packages/@sanity/vision/src/components/PerspectivePopover.tsx Outdated
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx Outdated
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx Outdated
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx Outdated
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx Outdated
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx Outdated
Comment thread packages/@sanity/vision/src/hooks/useSavedQueries.ts Outdated
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx Outdated
Comment thread packages/@sanity/vision/src/components/QueryRecall.tsx Outdated
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 21, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​codemirror/​search@​6.5.11 ⏵ 6.5.101001007688 +2100
Added@​xstate/​react@​5.0.31001008484100
Updated@​codemirror/​view@​6.36.8 ⏵ 6.36.7100 +110084 +194100
Addedxstate@​5.19.210010010087100
Addedstyled-components@​6.1.169410010092100
Updated@​sanity/​runtime-cli@​7.3.2 ⏵ 7.5.099 +1100100 +1100 +1100
Added@​portabletext/​block-tools@​1.1.25100100100100100

View full report

Copy link
Copy Markdown
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

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

Looks great @ChrisLaRocque , fantastic work!!
I really appreciate the extra effort getting it through the line, this such a nice addition to vision.
This should be into the highlights for next release.
Thank you!!

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.

3 participants