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

Image access error associated with a NotionAPI and defaultMapImageUrl

Open shongs27 opened this issue 3 years ago • 1 comments
trafficstars

Hello, I'm using the library you created. Thank you.

I'm having the same issue as #211

I'm looking at the code you wrote and I'm studying how various methods play a role.

I'm guessing that the issue I'm experiencing is related to a method called defaultMapImageUrl, and I found one while I was looking for a related code.

https://github.com/NotionX/react-notion-x/blob/bf81f2aa75c60b785e850b363901f47b9a2cd464/packages/react-notion-x/src/context.tsx#L13

The Function 'defaultMapImageUrl' was not found in the utils file

Is the problem I'm having coming from here?

As a junior, I would also like to ask you a question: How can I check the function that 'mapImageUrl' is doing? Because these methods are not written in official documents. it i Is the only way to check the code from scratch?

shongs27 avatar Aug 22 '22 13:08 shongs27

Another major factor for perf comes from images hosted by Notion. They're generally unoptimized, improperly sized, and not cacheable because Notion has to deal with fine-grained access control that users can change at any time. You can override the default mapImageUrl function on NotionRenderer to add caching via a CDN like Cloudflare Workers, which is what Notion X does for optimal page load speeds. - In Doc 'Performance'

I think the clue here is to cache the notion image

In this link, This Function is returning url with 'https://www.notion.so' and 'https://images.unsplash.com'. Does that mean add cache via CDN?

shongs27 avatar Aug 22 '22 14:08 shongs27