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(core): document store loader - swr in edit state #7552

Merged
merged 10 commits into from
Oct 9, 2024

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented Sep 27, 2024

Description

Adds in memory swr cache to the documents edit state, allowing us to render them immediately when you open the form instead of having to wait for it to be fully loaded again.
It works for the following case:

  • User navigates to document foo (Shows loading state)
  • User navigates to document bar (Shows loading state)
  • User navigates back to document foo (Shows document immediately, as it has been visited before)
Screen.Recording.2024-09-27.at.12.14.41.mov

What to review

Is this the right approach? Any side effects to consider that hasn't been considered here?

Testing

Existing tests have been updated with the changes introduced.

Notes for release

Adds swr cache for document edits state, navigating between previously visited documents in the studio is now instant

Copy link

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

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Sep 27, 2024

Component Testing Report Updated Oct 8, 2024 3:12 PM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 48s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 39s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 46s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 41s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 18s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 27s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 37s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

@pedrobonamin pedrobonamin force-pushed the document-store-loader-quicklru branch from 7e57e56 to b219e8d Compare September 27, 2024 09:58
@pedrobonamin pedrobonamin force-pushed the document-store-loader-quicklru branch from b219e8d to 79bc6c8 Compare October 1, 2024 06:45
@pedrobonamin pedrobonamin changed the base branch from next to refactor-rx-swr October 1, 2024 06:45
@pedrobonamin pedrobonamin force-pushed the document-store-loader-quicklru branch from 79bc6c8 to e1fda2c Compare October 1, 2024 06:51
@pedrobonamin pedrobonamin changed the title [WIP] feat(core): Document store loader quick-lru feat(core): document store loader quick-lru for edit state Oct 1, 2024
bjoerge
bjoerge previously approved these changes Oct 8, 2024
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.

Such a great improvement ✨⚡

id: idPair.publishedId,
type: typeName,
draft: draftSnapshot,
published: publishedSnapshot,
liveEdit,
ready: true,
transactionSyncLock,
ready: !fromCache,
Copy link
Member

Choose a reason for hiding this comment

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

would it make sense to pass fromCache as a separate property on EditState? The granularity might be useful in certain cases (can do this later if the need arises though)

@pedrobonamin pedrobonamin added this pull request to the merge queue Oct 9, 2024
Merged via the queue into next with commit e3cc6d5 Oct 9, 2024
64 checks passed
@pedrobonamin pedrobonamin deleted the document-store-loader-quicklru branch October 9, 2024 13:23
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.

2 participants