NotionX / NotionX/react-notion-x
How do you get collection data header values?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 645
- PR merge metrics
- No merged PRs in 30d
Description
How would I be able to fetch the collection property names using getCollectionData??
I am using the below snippet to get the format of the collection data, but it's coming jumbled up except for the first column.
Object.keys(collectionView).forEach((cid) => {
console.log(collectionView[cid].value.format);
});
Format of the data:
{
table_wrap: true,
table_properties: [
{ width: 276, visible: true, property: 'title' },
{ width: 200, visible: true, property: '3x=Q' },
{ width: 200, visible: true, property: 'S)s,' },
{ width: 411, visible: true, property: 'o+,#' }
]
}
If it helps, I'm trying to build a simple blog with the index page holding the links to all the different pages based on their slug and not the pageId.
Public link for the collection: https://www.notion.so/hamzamoiyadi/52db845d75fb4e8396b66234f05caecb?v=afb3d901772e474195c013570f511696
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at getCollectionData and trace collectionView[cid].value.format, focusing on the table_properties entries and their property identifiers. Compare those values with the linked collection's displayed columns; done means the collection property names can be obtained reliably rather than appearing jumbled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100