feat: subpages component improvements - #2488
Open
salihudickson wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues affect accessibility, localization, nested loading, pagination, and sorting behavior.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Improves subpage sorting and recursive nested-page rendering.
Changes:
- Adds persisted sort options and editor controls.
- Supports expandable, lazy-loaded nested subpages.
- Adds sorting utilities and nested-row styling.
File summaries
| File | Description |
|---|---|
packages/editor-ext/src/lib/subpages/subpages.ts |
Adds sort attributes and commands. |
packages/editor-ext/src/lib/subpages/index.ts |
Exports the sort type. |
apps/client/src/features/editor/components/subpages/subpages.utils.ts |
Implements subpage sorting. |
apps/client/src/features/editor/components/subpages/subpages.module.css |
Styles nested rows and controls. |
apps/client/src/features/editor/components/subpages/subpages-view.tsx |
Integrates sorting and recursive items. |
apps/client/src/features/editor/components/subpages/subpages-menu.tsx |
Adds sort controls. |
apps/client/src/features/editor/components/subpages/subpage-item.tsx |
Renders expandable nested subpages. |
Review details
Suppressed comments (4)
apps/client/src/features/editor/components/subpages/subpage-item.tsx:62
- This is an infinite query with a cursor and a 100-item limit, but the nested renderer only flattens pages already fetched and never calls
fetchNextPageor exposeshasNextPage. A parent with more than 100 children will silently omit the remainder, so load all pages or provide a load-more path.
const pages = data?.pages.flatMap((result) => result.items) || [];
return sortSubpages(pages, sortBy);
apps/client/src/features/editor/components/subpages/subpages-view.tsx:23
sortSubpagesonly treats"default"as the position-order sentinel; any other value falls into the title-ascending branch. Using"position"here therefore changes nodes with a missingsortByattribute to alphabetical order instead of preserving the existing position order. Use"default"as the fallback.
const sortBy = (props.node.attrs.sortBy || "position") as SubpagesSortBy;
apps/client/src/features/editor/components/subpages/subpages.utils.ts:3
- This union duplicates the
SubpagesSortBytype exported by@docmost/editor-ext(and now used by the node command). Keeping separate declarations can let the renderer and editor command accept different values; import and re-export the package type here so the existing local imports share one source of truth.
export type SubpagesSortBy = "default" | "title-asc" | "title-desc";
apps/client/src/features/editor/components/subpages/subpages.utils.ts:22
sortByis typed as a union, but runtime values are not guaranteed: the view currently falls back to"position", and the node parser accepts arbitrarydata-sort-bystrings. Such a value skips thisdefaultcheck and is treated as ascending title order below, so malformed or legacy nodes can lose their position ordering. Normalize unsupported values to the default/position branch here.
if (sortBy === "default") {
return sortPositionKeys(sortedItems);
}
- Files reviewed: 7/7 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+42
to
+44
| const { data, isLoading } = useGetSidebarPagesQuery( | ||
| !shareId && opened ? { pageId: page.id } : undefined | ||
| ); |
salihudickson
force-pushed
the
feat/subpages
branch
from
September 11, 2026 22:39
acb0f80 to
b1d3c84
Compare
salihudickson
marked this pull request as ready for review
September 12, 2026 13:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #1568