mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 23:16:48 +00:00
优化重试请求逻辑
This commit is contained in:
@@ -3,7 +3,7 @@ import { getDataFromCache, setDataToCache } from '@/lib/cache/cache_manager'
|
||||
import { getPostBlocks } from '@/lib/notion/getPostBlocks'
|
||||
import { idToUuid } from 'notion-utils'
|
||||
import { defaultMapImageUrl } from 'react-notion-x'
|
||||
import { isIterable } from '../utils'
|
||||
import { deepClone, isIterable } from '../utils'
|
||||
import getAllPageIds from './getAllPageIds'
|
||||
import { getAllPosts } from './getAllPosts'
|
||||
import { getAllTags } from './getAllTags'
|
||||
@@ -25,7 +25,9 @@ export async function getGlobalNotionData({
|
||||
from,
|
||||
pageType = ['Post']
|
||||
}) {
|
||||
const notionPageData = await getNotionPageData({ pageId, from })
|
||||
// 深拷贝数据
|
||||
const notionPageData = deepClone(await getNotionPageData({ pageId, from }))
|
||||
|
||||
const allPosts = await getAllPosts({ notionPageData, from, pageType })
|
||||
notionPageData.allPosts = allPosts
|
||||
// 删除前端不需要的数据
|
||||
@@ -196,8 +198,9 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
|
||||
if (!pageRecordMap) {
|
||||
return []
|
||||
}
|
||||
pageId = idToUuid(pageId)
|
||||
const block = pageRecordMap.block
|
||||
const rawMetadata = block[pageId].value
|
||||
const rawMetadata = block[pageId]?.value
|
||||
// Check Type Page-Database和Inline-Database
|
||||
if (
|
||||
rawMetadata?.type !== 'collection_view_page' &&
|
||||
@@ -207,7 +210,6 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
|
||||
return null
|
||||
}
|
||||
|
||||
pageId = idToUuid(pageId)
|
||||
const collection = Object.values(pageRecordMap.collection)[0]?.value
|
||||
const collectionQuery = pageRecordMap.collection_query
|
||||
const schema = collection?.schema
|
||||
|
||||
Reference in New Issue
Block a user