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: notify AUS studio users of new studio versions #6893

Merged
merged 19 commits into from
Jun 18, 2024

Conversation

cngonzalez
Copy link
Member

@cngonzalez cngonzalez commented Jun 10, 2024

Description

As we move to certain packages being able to auto-update, we want end-users of the studio to know when to refresh their browsers and work with the most up-to-date packages.

Screenshot 2024-06-18 at 11 01 51 AM

This PR adds a Provider that will:

  1. Poll an endpoint in module-server every 30 minutes to check for the most up-to-date packages.
  2. Check if the current studio is an auto-updating studio.
  3. If so, send a toast alerting the user to reload their browsers, along with a button.

What to review

  1. The language and design of the toast.
  2. The logic of the check -- anything strange?

Unfortunately I think the reviewer ought to pull this down and review manually -- see below for why (because of limited ability to test).

Testing

I've added a few e2e tests. I'm not testing if the reload button actually reloads the page; I couldn't find an easy way for Playwright to listen to that event.

Copy link

vercel bot commented Jun 10, 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 Jun 18, 2024 3:18pm
performance-studio ✅ Ready (Inspect) Visit Preview Jun 18, 2024 3:18pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2024 3:18pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2024 3:18pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2024 3:18pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jun 18, 2024 3:18pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jun 11, 2024

Component Testing Report Updated Jun 18, 2024 3:10 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 7s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 31s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 37s 3 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 17s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 4s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 21s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 30s 12 0 0

Copy link
Contributor

@binoy14 binoy14 left a comment

Choose a reason for hiding this comment

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

Overall looks good have some thoughts and questions


const MODULES_URL_VERSION = 'v1'

const MODULES_URL = `https://sanity-cdn.com/${MODULES_URL_VERSION}/modules/`
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we somehow share this with logic in CLI here? https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/_internal/cli/util/getAutoUpdatesImportMap.ts#L11

Maybe we just need to lift this out in some constant?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, yeah. Do we have precedent for sharing something like this between CLI and studio? Otherwise, happy to copy.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if there is, might be worth asking internally but for now okay with copy pasting as well

ricokahler
ricokahler previously approved these changes Jun 18, 2024
packages/sanity/src/core/i18n/bundles/studio.ts Outdated Show resolved Hide resolved
packages/sanity/src/core/i18n/bundles/studio.ts Outdated Show resolved Hide resolved
packages/sanity/src/core/i18n/bundles/studio.ts Outdated Show resolved Hide resolved
Co-authored-by: Rune Botten <rbotten@gmail.com>
cngonzalez and others added 2 commits June 18, 2024 10:51
Co-authored-by: Rune Botten <rbotten@gmail.com>
Co-authored-by: Rune Botten <rbotten@gmail.com>
ricokahler
ricokahler previously approved these changes Jun 18, 2024
@cngonzalez cngonzalez added this pull request to the merge queue Jun 18, 2024
Merged via the queue into next with commit e9b16c8 Jun 18, 2024
41 of 42 checks passed
@cngonzalez cngonzalez deleted the sdx-1244/notify-user-of-new-version branch June 18, 2024 15:13
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.

6 participants