react-notion-x icon indicating copy to clipboard operation
react-notion-x copied to clipboard

Remove page cover position if cover doesn't exist (#351)

Open FranciscoMoretti opened this issue 3 years ago • 2 comments
trafficstars

Description

Remove the page_cover_position if the page_cover doesn't exist in a block format. This allows the block to use the defaultPageCoverPosition for defaultPageCover.

#351 explains that a cover page_cover_position can exist for a page that doesn't have a page_cover if the cover was removed.

Notion pages seem to keep the page_cover_position in a page format even if the cover was removed. The Block component from packages/react-notion-x/src/block.tsx uses the page_cover_position from the page format if it's available instead of the defaultPageCoverPosition.

The problem happens when using NotionRenderer with defaultPageCover and defaultPageCoverPosition with a page that used to have a cover. In this case it uses the page_cover_position from the cover that was removed with the defaultPageCover. defaultPageCoverPosition is ignored.

Notion Test Page ID

This page used to have a cover and has a numeric page_cover_position value as part of its format. It doesn't have page_cover as part of its format.

FranciscoMoretti avatar Aug 13 '22 19:08 FranciscoMoretti

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

Name Status Preview Comments Updated
react-notion-x ❌ Failed (Inspect) Feb 9, 2023 at 1:33PM (UTC)
react-notion-x-minimal-demo ❌ Failed (Inspect) Feb 9, 2023 at 1:33PM (UTC)

vercel[bot] avatar Aug 13 '22 19:08 vercel[bot]

FYI @transitive-bullshit this is one ready to be merged

FranciscoMoretti avatar Aug 18 '22 09:08 FranciscoMoretti