Commit f571d7e7 authored by StyleZhang's avatar StyleZhang

fix: notion-page-selector

parent fa3522dc
...@@ -39,11 +39,13 @@ const recursivePushInParentDescendants = ( ...@@ -39,11 +39,13 @@ const recursivePushInParentDescendants = (
const parentId = current.parent_id const parentId = current.parent_id
const pageId = current.page_id const pageId = current.page_id
if (!parentId || !pageId)
return
if (parentId !== 'root') { if (parentId !== 'root') {
if (!listTreeMap[parentId]) { if (!listTreeMap[parentId]) {
const children = new Set([pageId]) const children = new Set([pageId])
const descendants = new Set([pageId, leafItem.page_id]) const descendants = new Set([pageId, leafItem.page_id])
listTreeMap[parentId] = { listTreeMap[parentId] = {
...pagesMap[parentId], ...pagesMap[parentId],
children, children,
...@@ -85,17 +87,23 @@ const Item = memo(({ index, style, data }: ListChildComponentProps<{ ...@@ -85,17 +87,23 @@ const Item = memo(({ index, style, data }: ListChildComponentProps<{
const breadCrumbs = ancestors.length ? [...ancestors, current.page_name] : [current.page_name] const breadCrumbs = ancestors.length ? [...ancestors, current.page_name] : [current.page_name]
const renderArrow = () => { const renderArrow = () => {
return hasChild if (hasChild) {
? ( return (
<div <div
className={cn(s.arrow, current.expand && s['arrow-expand'], 'shrink-0 mr-1 w-5 h-5 hover:bg-gray-200 rounded-md')} className={cn(s.arrow, current.expand && s['arrow-expand'], 'shrink-0 mr-1 w-5 h-5 hover:bg-gray-200 rounded-md')}
style={{ marginLeft: current.deepth * 8 }} style={{ marginLeft: current.deepth * 8 }}
onClick={() => handleToggle(index)} onClick={() => handleToggle(index)}
/> />
) )
: ( }
<div className='shrink-0 mr-1 w-5 h-5' style={{ marginLeft: current.deepth * 8 }} /> if (current.parent_id === 'root') {
return (
<div></div>
) )
}
return (
<div className='shrink-0 mr-1 w-5 h-5' style={{ marginLeft: current.deepth * 8 }} />
)
} }
return ( return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment