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(structure): add sheet list table view. #6647

Merged
merged 10 commits into from
May 16, 2024
Merged

feat(structure): add sheet list table view. #6647

merged 10 commits into from
May 16, 2024

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented May 14, 2024

Description

This PR integrates the initial changes needed to render the table view inside structure.
The table is generated using tanstack/table
The table data is fetched in two pieces:

  • First part is done by reusing the search mechanism from the studio global search, this provides a list of document ids to show in the table.
  • Second part is handled by the useDocumentSheetListStore this hook takes care of mounting a listener for the _type that is displayed in the table, keeping the documents in view and not in view updated.

Combining this two fetch mechanisms allows us to reuse the search functionality which is powerful and users already know and get the benefits of up to date data with the store hook.

Other changes

Refactors search to export some necessary components that are used in structure.

What to review

Testing

Notes for release

Nothing to mention. This is not gonna be accessible for users yet

Copy link

vercel bot commented May 14, 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 May 16, 2024 10:43am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 10:43am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 10:43am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview May 16, 2024 10:43am

Copy link

socket-security bot commented May 14, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@tanstack/react-table@8.16.0 Transitive: environment +1 4.04 MB tannerlinsley

🚮 Removed packages: npm/arrify@2.0.1, npm/async-mutex@0.4.1, npm/boxen@4.2.0, npm/cac@6.7.14

View full report↗︎

Copy link

socket-security bot commented May 14, 2024

👍 Dependency issues cleared. 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↗︎

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented May 14, 2024

Component Testing Report Updated May 16, 2024 10:48 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 27s 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/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ❌ Failed (Inspect) 1m 18s 19 0 1
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ❌ Failed (Inspect) 1m 9s 17 0 1
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 19s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 28s 12 0 0

@@ -0,0 +1,247 @@
import {type ListenEvent, type ListenOptions} from '@sanity/client'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

High chances this will be deprecated by the stream of concurrent work in which we will have 1 unique listener for all documents and we could use a new hook that mimics useEditState but will take a list of ids.

function useEditStateList(publishedDocIds: string[], docTypeName: string): EditStateFor[] {
  const documentStore = useDocumentStore()
  return useMemoObservable(() => {
    return combineLatest(
      publishedDocIds.map((publishedDocId) =>
        documentStore.pair.editState(publishedDocId, docTypeName),
      ),
    )
  }, [documentStore.pair, publishedDocIds, docTypeName]) as EditStateFor[]
}

jordanl17
jordanl17 previously approved these changes May 14, 2024
jordanl17
jordanl17 previously approved these changes May 15, 2024
@@ -0,0 +1,71 @@
/* eslint-disable i18next/no-literal-string */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have designs yet and we have high chances of removing pagination entirely, that why I avoid adding it to the translation resources

Copy link
Contributor

@jtpetty jtpetty left a comment

Choose a reason for hiding this comment

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

LGTM - am I correct in assuming this will not show up in the document list action menu yet?

@pedrobonamin
Copy link
Contributor Author

LGTM - am I correct in assuming this will not show up in the document list action menu yet?

Correct, to enable it in our studio we have the special action that trigger this, it won't be yet added for the rest of users.

@pedrobonamin pedrobonamin requested a review from stipsan May 16, 2024 12:57
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.

All good, doesn't break presentation 👍

@pedrobonamin pedrobonamin added this pull request to the merge queue May 16, 2024
Merged via the queue into next with commit c5916d4 May 16, 2024
39 checks passed
@pedrobonamin pedrobonamin deleted the edx-1284 branch May 16, 2024 13:45
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.

4 participants