-
Notifications
You must be signed in to change notification settings - Fork 426
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/arrify@2.0.1, npm/async-mutex@0.4.1, npm/boxen@4.2.0, npm/cac@6.7.14 |
👍 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. |
No changes to documentation |
Component Testing Report Updated May 16, 2024 10:48 AM (UTC)
|
@@ -0,0 +1,247 @@ | |||
import {type ListenEvent, type ListenOptions} from '@sanity/client' |
There was a problem hiding this comment.
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[]
}
packages/sanity/src/structure/panes/documentList/DocumentSheetListPane.tsx
Outdated
Show resolved
Hide resolved
The merge-base changed after approval.
@@ -0,0 +1,71 @@ | |||
/* eslint-disable i18next/no-literal-string */ |
There was a problem hiding this comment.
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
There was a problem hiding this 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?
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. |
There was a problem hiding this 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 👍
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:
search
mechanism from the studio global search, this provides a list of document ids to show in the table.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