Skip to content

Commit

Permalink
fix(problemset): 修复元素的查找
Browse files Browse the repository at this point in the history
  • Loading branch information
XYShaoKang committed Sep 20, 2023
1 parent 128e855 commit 253ec7d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/content/pages/problemset/Rank.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ const Rank: FC<{ enable: boolean }> = ({ enable }) => {
dispatch(enableProblemRating(currentPage!))
}
async function handleSetTableEl() {
const tableEl = await findElementByXPath('//div[@role="table"]')
const tableEl = await findElementByXPath(
{
xpath: '//div[@role="table"]',
nodeType: 'UNORDERED_NODE_ITERATOR_TYPE',
},
els => !!els.filter(el => el.childElementCount > 0)
)
if (!mountState.isMount) return

setTableEl(tableEl)
setTableEl(tableEl.find(el => el.childElementCount > 0))
}

useEffect(() => {
Expand Down

0 comments on commit 253ec7d

Please sign in to comment.