Tree view: hide the expand arrow on pages with no children
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start with src/features/collections/collection-table.tsx and trace both the expandable calculation and the row expansion check described in the issue. Find where collection folder and node entries are constructed, then determine how visible children can be reported without counting the node file, .gitkeep, excluded files, or other extensions. Done means the expand arrow appears only when the tree contains at least one visible child below the current page.
Written by the indexing model from the issue text.
Description
Problem
In a collection with view.layout: tree and a node filename, every node page shows an expand arrow, even when there's nothing below it. Clicking the arrow just expands to nothing.
In the screenshot, "Projects" is expanded but has no pages below it. Editors take the arrow to mean there are subpages, so it's confusing for clients.
Steps to reproduce
-
Set up a nested collection:
view: layout: tree node: filename: index.md hideDirs: nodes -
Add
projects/index.mdwith no other files or folders inprojects/. -
Open the collection and expand "Projects".
Expected: no arrow, as there's nothing to expand.
Actual: an arrow is shown, and it expands to an empty list.
Cause
In src/features/collections/collection-table.tsx, a row is expandable based only on its type:
const expandable = entry.type === 'dir' || entry.isNode
The row's expand check uses the same condition. Children load when the row is expanded, so the table doesn't know beforehand whether there are any.
Suggestion
Return something like hasChildren with each folder and node entry, and only show the arrow when it isn't false. It should count only what the tree would list, so ignoring the node file itself, .gitkeep, excluded files and other extensions.
Version
3.0.0 (npm, self-hosted on Cloudflare Workers)
- Dominant language
- TypeScript
- Stars
- 4.1k
- Forks
- 564
- Avg merge
- 8m
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hunvreus/pagescms
-
Media browser returns "Not found" for repositories using the SHA-256 object formatPossibly taken @adamchodera claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Hosted 3.0.1: email code sign-in fails for an invited collaborator ("code could not be verified")Open
Difficulty 3/5 1-2 days Newbie friendliness 52/100
hunvreus/pagescms#483 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
hunvreus/pagescms#464 · 1 comment ·
Maintainers usually reply within 1 day
All issues in hunvreus/pagescms
Similar issues
-
Follow-ups from #312Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
janhesters/remixcn#318 ·
Maintainers usually reply within 1 day
-
Interceptor LaunchTestProfile.sh: no Windows (Git Bash/MSYS) branch, test profile never launchesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
danielmiessler/LifeOS#3150 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Make the "%" unit spacing the same in the web and in A10Possibly taken @kragent66-glitch claimed this today. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 comment ·
-
NP OSS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
siteboon/claudecodeui#1905 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day