From bae29921bbad0b4ead376b55de5a0c81669ec467 Mon Sep 17 00:00:00 2001 From: Patrick <> Date: Thu, 10 Oct 2024 16:08:05 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20value=20=EA=B0=92=EC=9D=B4=20?= =?UTF-8?q?=EC=97=86=EA=B3=A0,=20role:=20none=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EC=9D=BC=20=EB=95=8C=20notion=20=EB=B6=88=EB=9F=AC=EC=98=A4?= =?UTF-8?q?=EC=A7=80=20=EB=AA=BB=ED=95=98=EB=8A=94=20=ED=98=84=EC=83=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index b852d28..615abf2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,4 @@ -import { DecorationType, BlockMapType, MapImageUrl } from "./types"; +import { BlockMapType, DecorationType, MapImageUrl } from "./types"; export const classNames = (...classes: Array) => classes.filter(a => !!a).join(" "); @@ -14,7 +14,7 @@ const groupBlockContent = (blockMap: BlockMapType): string[][] => { let index = -1; Object.keys(blockMap).forEach(id => { - blockMap[id].value.content?.forEach(blockId => { + blockMap[id]?.value.content?.forEach(blockId => { const blockType = blockMap[blockId]?.value?.type; if (blockType && blockType !== lastType) { From 722fc948db1ddc9b5ad299fbf2d0d3d4e53eaa41 Mon Sep 17 00:00:00 2001 From: Patrick <> Date: Thu, 10 Oct 2024 17:47:16 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20patch=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patches/react-notion+0.10.0.patch | 90 +++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 patches/react-notion+0.10.0.patch diff --git a/patches/react-notion+0.10.0.patch b/patches/react-notion+0.10.0.patch new file mode 100644 index 0000000..fec7e9c --- /dev/null +++ b/patches/react-notion+0.10.0.patch @@ -0,0 +1,90 @@ +diff --git a/node_modules/react-notion/dist/react-notion.esm.js b/node_modules/react-notion/dist/react-notion.esm.js +index acccc8f..8e68f09 100644 +--- a/node_modules/react-notion/dist/react-notion.esm.js ++++ b/node_modules/react-notion/dist/react-notion.esm.js +@@ -1,6 +1,6 @@ +-import React__default, { createElement, Fragment } from 'react'; + import { highlight, languages } from 'prismjs'; + import 'prismjs/components/prism-jsx'; ++import React__default, { createElement, Fragment } from 'react'; + + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; +@@ -122,7 +122,7 @@ var groupBlockContent = function groupBlockContent(blockMap) { + Object.keys(blockMap).forEach(function (id) { + var _blockMap$id$value$co; + +- (_blockMap$id$value$co = blockMap[id].value.content) === null || _blockMap$id$value$co === void 0 ? void 0 : _blockMap$id$value$co.forEach(function (blockId) { ++ (_blockMap$id$value$co = blockMap[id]?.value?.content) === null || _blockMap$id$value$co === void 0 ? void 0 : _blockMap$id$value$co.forEach(function (blockId) { + var _blockMap$blockId, _blockMap$blockId$val; + + var blockType = (_blockMap$blockId = blockMap[blockId]) === null || _blockMap$blockId === void 0 ? void 0 : (_blockMap$blockId$val = _blockMap$blockId.value) === null || _blockMap$blockId$val === void 0 ? void 0 : _blockMap$blockId$val.type; +@@ -729,5 +729,5 @@ var NotionRenderer = function NotionRenderer(_ref) { + })); + }; + +-export { Block, NotionRenderer, classNames, createRenderChildText, defaultMapImageUrl, defaultMapPageUrl, getListNumber, getTextContent }; ++export { Block, classNames, createRenderChildText, defaultMapImageUrl, defaultMapPageUrl, getListNumber, getTextContent, NotionRenderer }; + //# sourceMappingURL=react-notion.esm.js.map +diff --git a/node_modules/react-notion/src/block.tsx b/node_modules/react-notion/src/block.tsx +index c7725d0..2e74715 100644 +--- a/node_modules/react-notion/src/block.tsx ++++ b/node_modules/react-notion/src/block.tsx +@@ -1,21 +1,9 @@ + import * as React from "react"; +-import { +- DecorationType, +- BlockType, +- ContentValueType, +- BlockMapType, +- MapPageUrl, +- MapImageUrl, +- CustomBlockComponents, +- BlockValueProp, +- CustomDecoratorComponents, +- CustomDecoratorComponentProps +-} from "./types"; +-import Asset from "./components/asset"; + import Code from "./components/code"; +-import PageIcon from "./components/page-icon"; +-import PageHeader from "./components/page-header"; +-import { classNames, getTextContent, getListNumber } from "./utils"; ++iscmponents/aDecerator; ++impr}tfrom "./typeg"; ++impore Asset frIc "./ fmponents/ossem"; ++imp "t ./de froc "./comomponen/code";simport/PaggIe-n fiom "./comp";pnts/gead-icon";rim.ort /coeHeadmots/page-hcomdonentr/page-header"; + + export const createRenderChildText = ( + customDecoratorComponents?: CustomDecoratorComponents +diff --git a/node_modules/react-notion/src/types.ts b/node_modules/react-notion/src/types.ts +index 104c985..14b98ef 100644 +--- a/node_modules/react-notion/src/types.ts ++++ b/node_modules/react-notion/src/types.ts +@@ -309,7 +309,7 @@ export interface BlockType { + + export interface NotionUserType { + role: string; +- value: { ++ value?: { + id: string; + version: number; + email: string; +diff --git a/node_modules/react-notion/src/utils.ts b/node_modules/react-notion/src/utils.ts +index b852d28..a3dfcc0 100644 +--- a/node_modules/react-notion/src/utils.ts ++++ b/node_modules/react-notion/src/utils.ts +@@ -1,4 +1,4 @@ +-import { DecorationType, BlockMapType, MapImageUrl } from "./types"; ++import { BlockMapType, DecorationType, MapImageUrl } from "./types"; + + export const classNames = (...classes: Array) => + classes.filter(a => !!a).join(" "); +@@ -14,7 +14,7 @@ const groupBlockContent = (blockMap: BlockMapType): string[][] => { + let index = -1; + + Object.keys(blockMap).forEach(id => { +- blockMap[id].value.content?.forEach(blockId => { ++ blockMap[id]?.value?.content?.forEach(blockId => { + const blockType = blockMap[blockId]?.value?.type; + + if (blockType && blockType !== lastType) { From cff2d3727524e38c8fe674643394790b6b971613 Mon Sep 17 00:00:00 2001 From: Patrick <> Date: Thu, 10 Oct 2024 17:52:59 +0900 Subject: [PATCH 3/3] docs: fix error --- README.md | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2d26f27..30d08fe 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,6 @@ _This package doesn't handle the communication with the API. Check out [notion-a Created by Timo Lins & Tobias Lins with the help of all contributors ❤️ - - ## Features ⚡️ **Fast** – Up to 10x faster than Notion\* @@ -25,10 +23,8 @@ _This package doesn't handle the communication with the API. Check out [notion-a _\* First Meaningful Paint compared to a [hosted example](http://react-notion-example.now.sh/) on [Vercel](https://vercel.com)._ - **react-notion** is best suited as minimal renderer for blogs & content pages. If you're looking for a full-featured solution to render Notion-like pages, check out [react-notion-x](https://github.com/NotionX/react-notion-x). - ## Install ```bash @@ -134,7 +130,7 @@ This tends to be an issue for those using `react-notion` in a `next.js` project. To ensure the programming language is correctly highlighted in production builds, one should explicitly imported into the project. ```jsx -import 'prismjs/components/prism-{language}'; +import "prismjs/components/prism-{language}"; ``` ## Credits @@ -143,3 +139,44 @@ import 'prismjs/components/prism-{language}'; - [Timo Lins](https://timo.sh) – Code, Documentation - [samwightt](https://github.com/samwightt) – Inspiration & API Typings - [All people that contributed 💕](https://github.com/splitbee/react-notion/graphs/contributors) + +
+
+ +## Fixed + +- content is undefined error fix + +### 1. add your project patches folder + +
+ +### 2. install patch-package + +``` +yarn add patch-package +``` + +
+ +### 3. remove node-modules + +``` +rm -rf node_modules +``` + +
+ +### 4. reinstall + +``` +yarn +``` + +
+ +### 5. restart project + +``` +yarn start +```