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(core): add retry to image observer and loading state #6709

Merged
merged 2 commits into from
May 22, 2024
Merged

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented May 17, 2024

Description

We have a racing condition in the BaseImageInput component, in some cases, specially with big images the fetch request to resolve the reference is happening before the reference exists. Making the image input to persist in a "loading" state which nothing indicates it.
Also, there was no retry option when the reference was not properly resolved.

With this changes, a retry option is added to the observeAssetDoc function, fixing this problem.
Also, a loading state was included in the image input.

How to reproduce this issue:

Reproducing the issue in next

Screen.Recording.2024-05-17.at.11.20.41.mov

After fix

After the fix I was not able to reproduce this issue anymore.

Screen.Recording.2024-05-17.at.11.23.57.mov

What to review

Testing

Manual testing of the issue, couldn't reproduce it.

Notes for release

@pedrobonamin pedrobonamin requested a review from a team as a code owner May 17, 2024 09:18
@pedrobonamin pedrobonamin requested review from cngonzalez and removed request for a team May 17, 2024 09:18
Copy link

vercel bot commented May 17, 2024

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

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2024 1:27pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2024 1:27pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2024 1:27pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview May 21, 2024 1:27pm

@pedrobonamin pedrobonamin requested review from bjoerge and a team May 17, 2024 09:18
Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented May 17, 2024

Component Testing Report Updated May 21, 2024 1:31 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) 28s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 32s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 16s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 6s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 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
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Great find. We should investigate why we're getting stale data when refetching as a response to an event received from a listener set up with visibility=query, but this is a nice workaround in the meantime.

Would be great if you could add a comment to the operator chain to make it easier to know if/when it can be removed.

Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Thanks @pedrobonamin!

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.

None yet

2 participants