NotionX / react-notion-x

Fast and accurate React renderer for Notion. TS batteries included. ⚡️
https://react-notion-x-demo.transitivebullsh.it
MIT License
4.79k stars 559 forks source link

defaultPageCoverPosition is ignored if the notion page used to have a cover #351

Open FranciscoMoretti opened 2 years ago

FranciscoMoretti commented 2 years ago

Description

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.

transitive-bullshit commented 2 years ago

Great catch 💯

And thanks for the in-depth issue description + PR.